/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    ap-northeast-1 = 'ccc.aliyuncs.com',
    ap-south-1 = 'ccc.aliyuncs.com',
    ap-southeast-1 = 'ccc.aliyuncs.com',
    ap-southeast-2 = 'ccc.aliyuncs.com',
    ap-southeast-3 = 'ccc.aliyuncs.com',
    ap-southeast-5 = 'ccc.aliyuncs.com',
    cn-beijing = 'ccc.aliyuncs.com',
    cn-chengdu = 'ccc.aliyuncs.com',
    cn-hongkong = 'ccc.aliyuncs.com',
    cn-huhehaote = 'ccc.aliyuncs.com',
    cn-qingdao = 'ccc.aliyuncs.com',
    cn-shenzhen = 'ccc.aliyuncs.com',
    cn-zhangjiakou = 'ccc.aliyuncs.com',
    eu-central-1 = 'ccc.aliyuncs.com',
    eu-west-1 = 'ccc.aliyuncs.com',
    me-east-1 = 'ccc.aliyuncs.com',
    us-east-1 = 'ccc.aliyuncs.com',
    us-west-1 = 'ccc.aliyuncs.com',
    cn-hangzhou-finance = 'ccc.aliyuncs.com',
    cn-shenzhen-finance-1 = 'ccc.aliyuncs.com',
    cn-shanghai-finance-1 = 'ccc.aliyuncs.com',
    cn-north-2-gov-1 = 'ccc.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('ccc', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddAgentDeviceRequest {
  browserVersion?: string(name='BrowserVersion'),
  clientIp?: string(name='ClientIp'),
  clientPort?: string(name='ClientPort'),
  instanceId?: string(name='InstanceId'),
  remark?: string(name='Remark'),
}

model AddAgentDeviceResponseBody = {
  agentDeviceId?: long(name='AgentDeviceId'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddAgentDeviceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddAgentDeviceResponseBody(name='body'),
}

async function addAgentDeviceWithOptions(request: AddAgentDeviceRequest, runtime: Util.RuntimeOptions): AddAgentDeviceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientIp)) {
    query['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientPort)) {
    query['ClientPort'] = request.clientPort;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.browserVersion)) {
    body['BrowserVersion'] = request.browserVersion;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddAgentDevice',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addAgentDevice(request: AddAgentDeviceRequest): AddAgentDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  return addAgentDeviceWithOptions(request, runtime);
}

model AddBulkPhoneNumbersRequest {
  contactFlowId?: string(name='ContactFlowId'),
  instanceId?: string(name='InstanceId'),
  phoneNumber?: [ string ](name='PhoneNumber'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  usage?: string(name='Usage'),
}

model AddBulkPhoneNumbersResponseBody = {
  arrearagePhoneNumbers?: {
    arrearagePhoneNumber?: [ string ](name='ArrearagePhoneNumber')
  }(name='ArrearagePhoneNumbers'),
  code?: string(name='Code'),
  failedPhoneNumbers?: {
    failedPhoneNumber?: [ string ](name='FailedPhoneNumber')
  }(name='FailedPhoneNumbers'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  phoneNumbers?: {
    phoneNumber?: [ 
    {
      allowOutbound?: boolean(name='AllowOutbound'),
      contactFlow?: {
        contactFlowDescription?: string(name='ContactFlowDescription'),
        contactFlowId?: string(name='ContactFlowId'),
        contactFlowName?: string(name='ContactFlowName'),
        instanceId?: string(name='InstanceId'),
        type?: string(name='Type'),
      }(name='ContactFlow'),
      instanceId?: string(name='InstanceId'),
      number?: string(name='Number'),
      phoneNumberDescription?: string(name='PhoneNumberDescription'),
      phoneNumberId?: string(name='PhoneNumberId'),
      remainingTime?: int32(name='RemainingTime'),
      skillGroups?: {
        skillGroup?: [ 
        {
          skillGroupId?: string(name='SkillGroupId'),
          skillGroupName?: string(name='SkillGroupName'),
        }
      ](name='SkillGroup')
      }(name='SkillGroups'),
      testOnly?: boolean(name='TestOnly'),
      trunks?: int32(name='Trunks'),
      usage?: string(name='Usage'),
    }
  ](name='PhoneNumber')
  }(name='PhoneNumbers'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  userdPhoneNumbers?: {
    userdPhoneNumber?: [ string ](name='UserdPhoneNumber')
  }(name='UserdPhoneNumbers'),
}

model AddBulkPhoneNumbersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddBulkPhoneNumbersResponseBody(name='body'),
}

async function addBulkPhoneNumbersWithOptions(request: AddBulkPhoneNumbersRequest, runtime: Util.RuntimeOptions): AddBulkPhoneNumbersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowId)) {
    query['ContactFlowId'] = request.contactFlowId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.usage)) {
    query['Usage'] = request.usage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddBulkPhoneNumbers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addBulkPhoneNumbers(request: AddBulkPhoneNumbersRequest): AddBulkPhoneNumbersResponse {
  var runtime = new Util.RuntimeOptions{};
  return addBulkPhoneNumbersWithOptions(request, runtime);
}

model AddPhoneNumberRequest {
  contactFlowId?: string(name='ContactFlowId'),
  instanceId?: string(name='InstanceId'),
  phoneNumber?: string(name='PhoneNumber'),
  usage?: string(name='Usage'),
}

model AddPhoneNumberResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  phoneNumber?: {
    allowOutbound?: boolean(name='AllowOutbound'),
    contactFlow?: {
      contactFlowDescription?: string(name='ContactFlowDescription'),
      contactFlowId?: string(name='ContactFlowId'),
      contactFlowName?: string(name='ContactFlowName'),
      instanceId?: string(name='InstanceId'),
      type?: string(name='Type'),
    }(name='ContactFlow'),
    instanceId?: string(name='InstanceId'),
    number?: string(name='Number'),
    phoneNumberDescription?: string(name='PhoneNumberDescription'),
    phoneNumberId?: string(name='PhoneNumberId'),
    remainingTime?: int32(name='RemainingTime'),
    testOnly?: boolean(name='TestOnly'),
    trunks?: int32(name='Trunks'),
    usage?: string(name='Usage'),
  }(name='PhoneNumber'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddPhoneNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddPhoneNumberResponseBody(name='body'),
}

async function addPhoneNumberWithOptions(request: AddPhoneNumberRequest, runtime: Util.RuntimeOptions): AddPhoneNumberResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowId)) {
    query['ContactFlowId'] = request.contactFlowId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.usage)) {
    query['Usage'] = request.usage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddPhoneNumber',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addPhoneNumber(request: AddPhoneNumberRequest): AddPhoneNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return addPhoneNumberWithOptions(request, runtime);
}

model AddPhoneTagsRequest {
  concurrency?: int32(name='Concurrency'),
  instanceId?: string(name='InstanceId'),
  phoneNumberList?: [ string ](name='PhoneNumberList'),
  provider?: string(name='Provider'),
  regionNameCity?: string(name='RegionNameCity'),
  regionNameProvince?: string(name='RegionNameProvince'),
  serviceTag?: string(name='ServiceTag'),
  sipTag?: string(name='SipTag'),
  type?: int32(name='Type'),
}

model AddPhoneTagsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AddPhoneTagsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddPhoneTagsResponseBody(name='body'),
}

async function addPhoneTagsWithOptions(request: AddPhoneTagsRequest, runtime: Util.RuntimeOptions): AddPhoneTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.concurrency)) {
    query['Concurrency'] = request.concurrency;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumberList)) {
    query['PhoneNumberList'] = request.phoneNumberList;
  }
  if (!Util.isUnset(request.provider)) {
    query['Provider'] = request.provider;
  }
  if (!Util.isUnset(request.regionNameCity)) {
    query['RegionNameCity'] = request.regionNameCity;
  }
  if (!Util.isUnset(request.regionNameProvince)) {
    query['RegionNameProvince'] = request.regionNameProvince;
  }
  if (!Util.isUnset(request.serviceTag)) {
    query['ServiceTag'] = request.serviceTag;
  }
  if (!Util.isUnset(request.sipTag)) {
    query['SipTag'] = request.sipTag;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddPhoneTags',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addPhoneTags(request: AddPhoneTagsRequest): AddPhoneTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return addPhoneTagsWithOptions(request, runtime);
}

model AssignUsersRequest {
  instanceId?: string(name='InstanceId'),
  roleId?: [ string ](name='RoleId'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  skillLevel?: [ int32 ](name='SkillLevel'),
  userRamId?: [ string ](name='UserRamId'),
}

model AssignUsersResponseBody = {
  code?: string(name='Code'),
  data?: {
    user?: [ 
    {
      instanceId?: string(name='InstanceId'),
      primary?: boolean(name='Primary'),
      ramId?: string(name='RamId'),
      userId?: string(name='UserId'),
    }
  ](name='User')
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AssignUsersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AssignUsersResponseBody(name='body'),
}

async function assignUsersWithOptions(request: AssignUsersRequest, runtime: Util.RuntimeOptions): AssignUsersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.roleId)) {
    query['RoleId'] = request.roleId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillLevel)) {
    query['SkillLevel'] = request.skillLevel;
  }
  if (!Util.isUnset(request.userRamId)) {
    query['UserRamId'] = request.userRamId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AssignUsers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function assignUsers(request: AssignUsersRequest): AssignUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return assignUsersWithOptions(request, runtime);
}

model CallOnlinePrivacyNumberRequest {
  instanceId?: string(name='InstanceId'),
  telA?: string(name='TelA'),
  telB?: string(name='TelB'),
}

model CallOnlinePrivacyNumberResponseBody = {
  code?: string(name='Code'),
  data?: {
    callId?: string(name='CallId'),
    dateCreated?: string(name='DateCreated'),
    represent?: string(name='Represent'),
    statusCode?: string(name='StatusCode'),
    telX?: string(name='TelX'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CallOnlinePrivacyNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CallOnlinePrivacyNumberResponseBody(name='body'),
}

async function callOnlinePrivacyNumberWithOptions(request: CallOnlinePrivacyNumberRequest, runtime: Util.RuntimeOptions): CallOnlinePrivacyNumberResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.telA)) {
    query['TelA'] = request.telA;
  }
  if (!Util.isUnset(request.telB)) {
    query['TelB'] = request.telB;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CallOnlinePrivacyNumber',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function callOnlinePrivacyNumber(request: CallOnlinePrivacyNumberRequest): CallOnlinePrivacyNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return callOnlinePrivacyNumberWithOptions(request, runtime);
}

model CheckNumberAvaliableRequest {
  callee?: string(name='Callee'),
  caller?: string(name='Caller'),
  instanceId?: string(name='InstanceId'),
}

model CheckNumberAvaliableResponseBody = {
  calleeAvaliable?: {
    avaliable?: boolean(name='Avaliable'),
    reason?: string(name='Reason'),
  }(name='CalleeAvaliable'),
  callerAvaliable?: {
    avaliable?: boolean(name='Avaliable'),
    reason?: string(name='Reason'),
  }(name='CallerAvaliable'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CheckNumberAvaliableResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckNumberAvaliableResponseBody(name='body'),
}

async function checkNumberAvaliableWithOptions(request: CheckNumberAvaliableRequest, runtime: Util.RuntimeOptions): CheckNumberAvaliableResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.callee)) {
    query['Callee'] = request.callee;
  }
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckNumberAvaliable',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkNumberAvaliable(request: CheckNumberAvaliableRequest): CheckNumberAvaliableResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkNumberAvaliableWithOptions(request, runtime);
}

model CommitContactFlowVersionModificationRequest {
  canvas?: string(name='Canvas'),
  contactFlowVersionId?: string(name='ContactFlowVersionId'),
  content?: string(name='Content'),
  instanceId?: string(name='InstanceId'),
}

model CommitContactFlowVersionModificationResponseBody = {
  code?: string(name='Code'),
  contactFlowVersion?: {
    canvas?: string(name='Canvas'),
    contactFlowVersionDescription?: string(name='ContactFlowVersionDescription'),
    contactFlowVersionId?: string(name='ContactFlowVersionId'),
    content?: string(name='Content'),
    lastModified?: string(name='LastModified'),
    lastModifiedBy?: string(name='LastModifiedBy'),
    lockedBy?: string(name='LockedBy'),
    status?: string(name='Status'),
    version?: string(name='Version'),
  }(name='ContactFlowVersion'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CommitContactFlowVersionModificationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CommitContactFlowVersionModificationResponseBody(name='body'),
}

async function commitContactFlowVersionModificationWithOptions(request: CommitContactFlowVersionModificationRequest, runtime: Util.RuntimeOptions): CommitContactFlowVersionModificationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowVersionId)) {
    query['ContactFlowVersionId'] = request.contactFlowVersionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.canvas)) {
    body['Canvas'] = request.canvas;
  }
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CommitContactFlowVersionModification',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function commitContactFlowVersionModification(request: CommitContactFlowVersionModificationRequest): CommitContactFlowVersionModificationResponse {
  var runtime = new Util.RuntimeOptions{};
  return commitContactFlowVersionModificationWithOptions(request, runtime);
}

model CreateContactFlowRequest {
  canvas?: string(name='Canvas'),
  content?: string(name='Content'),
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  type?: string(name='Type'),
}

model CreateContactFlowResponseBody = {
  code?: string(name='Code'),
  contactFlow?: {
    appliedVersion?: string(name='AppliedVersion'),
    contactFlowDescription?: string(name='ContactFlowDescription'),
    contactFlowId?: string(name='ContactFlowId'),
    contactFlowName?: string(name='ContactFlowName'),
    instanceId?: string(name='InstanceId'),
    phoneNumbers?: {
      phoneNumber?: [ 
      {
        allowOutbound?: boolean(name='AllowOutbound'),
        instanceId?: string(name='InstanceId'),
        number?: string(name='Number'),
        phoneNumberDescription?: string(name='PhoneNumberDescription'),
        phoneNumberId?: string(name='PhoneNumberId'),
        remainingTime?: int32(name='RemainingTime'),
        testOnly?: boolean(name='TestOnly'),
        trunks?: int32(name='Trunks'),
        usage?: string(name='Usage'),
      }
    ](name='PhoneNumber')
    }(name='PhoneNumbers'),
    type?: string(name='Type'),
    versions?: {
      contactFlowVersion?: [ 
      {
        canvas?: string(name='Canvas'),
        contactFlowVersionDescription?: string(name='ContactFlowVersionDescription'),
        contactFlowVersionId?: string(name='ContactFlowVersionId'),
        content?: string(name='Content'),
        lastModified?: string(name='LastModified'),
        lastModifiedBy?: string(name='LastModifiedBy'),
        lockedBy?: string(name='LockedBy'),
        status?: string(name='Status'),
        version?: string(name='Version'),
      }
    ](name='ContactFlowVersion')
    }(name='Versions'),
  }(name='ContactFlow'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateContactFlowResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateContactFlowResponseBody(name='body'),
}

async function createContactFlowWithOptions(request: CreateContactFlowRequest, runtime: Util.RuntimeOptions): CreateContactFlowResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.canvas)) {
    body['Canvas'] = request.canvas;
  }
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateContactFlow',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createContactFlow(request: CreateContactFlowRequest): CreateContactFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return createContactFlowWithOptions(request, runtime);
}

model CreateFaultRequest {
  agentFilePath?: string(name='AgentFilePath'),
  agentId?: long(name='AgentId'),
  agentOssFileName?: string(name='AgentOssFileName'),
  browserVersion?: string(name='BrowserVersion'),
  clientIp?: string(name='ClientIp'),
  clientPort?: string(name='ClientPort'),
  connectId?: string(name='ConnectId'),
  customFilePath?: string(name='CustomFilePath'),
  customOssFileName?: string(name='CustomOssFileName'),
  description?: string(name='Description'),
  endTime?: long(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  microphoneEquipment?: string(name='MicrophoneEquipment'),
  microphoneList?: string(name='MicrophoneList'),
  operatingSystemVersion?: string(name='OperatingSystemVersion'),
  serviceIp?: string(name='ServiceIp'),
  servicePort?: string(name='ServicePort'),
  speakerEquipment?: string(name='SpeakerEquipment'),
  speakerList?: string(name='SpeakerList'),
  startTime?: long(name='StartTime'),
}

model CreateFaultResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateFaultResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateFaultResponseBody(name='body'),
}

async function createFaultWithOptions(request: CreateFaultRequest, runtime: Util.RuntimeOptions): CreateFaultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentFilePath)) {
    query['AgentFilePath'] = request.agentFilePath;
  }
  if (!Util.isUnset(request.agentId)) {
    query['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.agentOssFileName)) {
    query['AgentOssFileName'] = request.agentOssFileName;
  }
  if (!Util.isUnset(request.browserVersion)) {
    query['BrowserVersion'] = request.browserVersion;
  }
  if (!Util.isUnset(request.clientIp)) {
    query['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientPort)) {
    query['ClientPort'] = request.clientPort;
  }
  if (!Util.isUnset(request.connectId)) {
    query['ConnectId'] = request.connectId;
  }
  if (!Util.isUnset(request.customFilePath)) {
    query['CustomFilePath'] = request.customFilePath;
  }
  if (!Util.isUnset(request.customOssFileName)) {
    query['CustomOssFileName'] = request.customOssFileName;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.microphoneEquipment)) {
    query['MicrophoneEquipment'] = request.microphoneEquipment;
  }
  if (!Util.isUnset(request.microphoneList)) {
    query['MicrophoneList'] = request.microphoneList;
  }
  if (!Util.isUnset(request.operatingSystemVersion)) {
    query['OperatingSystemVersion'] = request.operatingSystemVersion;
  }
  if (!Util.isUnset(request.serviceIp)) {
    query['ServiceIp'] = request.serviceIp;
  }
  if (!Util.isUnset(request.servicePort)) {
    query['ServicePort'] = request.servicePort;
  }
  if (!Util.isUnset(request.speakerEquipment)) {
    query['SpeakerEquipment'] = request.speakerEquipment;
  }
  if (!Util.isUnset(request.speakerList)) {
    query['SpeakerList'] = request.speakerList;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFault',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createFault(request: CreateFaultRequest): CreateFaultResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFaultWithOptions(request, runtime);
}

model CreateInstanceRequest {
  adminRamId?: [ string ](name='AdminRamId'),
  description?: string(name='Description'),
  directoryId?: string(name='DirectoryId'),
  domainName?: string(name='DomainName'),
  name?: string(name='Name'),
  phoneNumber?: string(name='PhoneNumber'),
  phoneNumbers?: [ string ](name='PhoneNumbers'),
  storageMaxDays?: int32(name='StorageMaxDays'),
  storageMaxSize?: int32(name='StorageMaxSize'),
  userObject?: [ string ](name='UserObject'),
}

model CreateInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  instance?: {
    admin?: {
      user?: [ 
      {
        detail?: {
          department?: string(name='Department'),
          displayName?: string(name='DisplayName'),
          email?: string(name='Email'),
          loginName?: string(name='LoginName'),
          phone?: string(name='Phone'),
        }(name='Detail'),
        instanceId?: string(name='InstanceId'),
        ramId?: string(name='RamId'),
        userId?: string(name='UserId'),
      }
    ](name='User')
    }(name='Admin'),
    consoleUrl?: string(name='ConsoleUrl'),
    createdTime?: long(name='CreatedTime'),
    directoryId?: string(name='DirectoryId'),
    domainName?: string(name='DomainName'),
    failLoginNames?: {
      failLoginName?: [ string ](name='FailLoginName')
    }(name='FailLoginNames'),
    failPhoneNumbers?: {
      failPhoneNumber?: [ string ](name='FailPhoneNumber')
    }(name='FailPhoneNumbers'),
    instanceDescription?: string(name='InstanceDescription'),
    instanceId?: string(name='InstanceId'),
    instanceName?: string(name='InstanceName'),
    maxOnlineAgents?: int32(name='MaxOnlineAgents'),
    owner?: string(name='Owner'),
    phoneNumbers?: {
      phoneNumber?: [ 
      {
        allowOutbound?: boolean(name='AllowOutbound'),
        instanceId?: string(name='InstanceId'),
        number?: string(name='Number'),
        phoneNumberDescription?: string(name='PhoneNumberDescription'),
        phoneNumberId?: string(name='PhoneNumberId'),
        remainingTime?: int32(name='RemainingTime'),
        testOnly?: boolean(name='TestOnly'),
        trunks?: int32(name='Trunks'),
        usage?: string(name='Usage'),
      }
    ](name='PhoneNumber')
    }(name='PhoneNumbers'),
    status?: string(name='Status'),
    storageBucket?: string(name='StorageBucket'),
    storageMaxDays?: int32(name='StorageMaxDays'),
    storageMaxSize?: int32(name='StorageMaxSize'),
    successLoginNames?: {
      successLoginName?: [ string ](name='SuccessLoginName')
    }(name='SuccessLoginNames'),
    successPhoneNumbers?: {
      successPhoneNumber?: [ string ](name='SuccessPhoneNumber')
    }(name='SuccessPhoneNumbers'),
    tenantId?: string(name='TenantId'),
  }(name='Instance'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateInstanceResponseBody(name='body'),
}

async function createInstanceWithOptions(request: CreateInstanceRequest, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adminRamId)) {
    query['AdminRamId'] = request.adminRamId;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.directoryId)) {
    query['DirectoryId'] = request.directoryId;
  }
  if (!Util.isUnset(request.domainName)) {
    query['DomainName'] = request.domainName;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.phoneNumbers)) {
    query['PhoneNumbers'] = request.phoneNumbers;
  }
  if (!Util.isUnset(request.storageMaxDays)) {
    query['StorageMaxDays'] = request.storageMaxDays;
  }
  if (!Util.isUnset(request.storageMaxSize)) {
    query['StorageMaxSize'] = request.storageMaxSize;
  }
  if (!Util.isUnset(request.userObject)) {
    query['UserObject'] = request.userObject;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createInstanceWithOptions(request, runtime);
}

model CreateMediaRequest {
  content?: string(name='Content'),
  description?: string(name='Description'),
  fileName?: string(name='FileName'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  ossFileName?: string(name='OssFileName'),
  ossFilePath?: string(name='OssFilePath'),
  type?: string(name='Type'),
  uploadResult?: string(name='UploadResult'),
}

model CreateMediaResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  mediaUploadParam?: {
    fileName?: string(name='FileName'),
    id?: string(name='Id'),
    instance?: string(name='Instance'),
    name?: string(name='Name'),
    ossFileName?: string(name='OssFileName'),
    ossFilePath?: string(name='OssFilePath'),
  }(name='MediaUploadParam'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateMediaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateMediaResponseBody(name='body'),
}

async function createMediaWithOptions(request: CreateMediaRequest, runtime: Util.RuntimeOptions): CreateMediaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ossFileName)) {
    query['OssFileName'] = request.ossFileName;
  }
  if (!Util.isUnset(request.ossFilePath)) {
    query['OssFilePath'] = request.ossFilePath;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.uploadResult)) {
    query['UploadResult'] = request.uploadResult;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateMedia',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createMedia(request: CreateMediaRequest): CreateMediaResponse {
  var runtime = new Util.RuntimeOptions{};
  return createMediaWithOptions(request, runtime);
}

model CreateSkillGroupRequest {
  allowPrivateOutboundNumber?: boolean(name='AllowPrivateOutboundNumber'),
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  outboundPhoneNumberId?: [ string ](name='OutboundPhoneNumberId'),
  routingStrategy?: string(name='RoutingStrategy'),
  skillLevel?: [ int32 ](name='SkillLevel'),
  userId?: [ string ](name='UserId'),
}

model CreateSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  skillGroupId?: string(name='SkillGroupId'),
  success?: boolean(name='Success'),
}

model CreateSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSkillGroupResponseBody(name='body'),
}

async function createSkillGroupWithOptions(request: CreateSkillGroupRequest, runtime: Util.RuntimeOptions): CreateSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.allowPrivateOutboundNumber)) {
    query['AllowPrivateOutboundNumber'] = request.allowPrivateOutboundNumber;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.outboundPhoneNumberId)) {
    query['OutboundPhoneNumberId'] = request.outboundPhoneNumberId;
  }
  if (!Util.isUnset(request.routingStrategy)) {
    query['RoutingStrategy'] = request.routingStrategy;
  }
  if (!Util.isUnset(request.skillLevel)) {
    query['SkillLevel'] = request.skillLevel;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSkillGroup(request: CreateSkillGroupRequest): CreateSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSkillGroupWithOptions(request, runtime);
}

model CreateUserRequest {
  displayName?: string(name='DisplayName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  loginName?: string(name='LoginName'),
  phone?: string(name='Phone'),
  privateOutboundNumberId?: string(name='PrivateOutboundNumberId'),
  roleId?: [ string ](name='RoleId'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  skillLevel?: [ int32 ](name='SkillLevel'),
}

model CreateUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  userId?: string(name='UserId'),
}

model CreateUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateUserResponseBody(name='body'),
}

async function createUserWithOptions(request: CreateUserRequest, runtime: Util.RuntimeOptions): CreateUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.loginName)) {
    query['LoginName'] = request.loginName;
  }
  if (!Util.isUnset(request.phone)) {
    query['Phone'] = request.phone;
  }
  if (!Util.isUnset(request.privateOutboundNumberId)) {
    query['PrivateOutboundNumberId'] = request.privateOutboundNumberId;
  }
  if (!Util.isUnset(request.roleId)) {
    query['RoleId'] = request.roleId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillLevel)) {
    query['SkillLevel'] = request.skillLevel;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createUser(request: CreateUserRequest): CreateUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return createUserWithOptions(request, runtime);
}

model CreateVoiceAppraiseRequest {
  contactFlowVersionId?: string(name='ContactFlowVersionId'),
  content?: string(name='Content'),
  instanceId?: string(name='InstanceId'),
  isAppraise?: boolean(name='IsAppraise'),
}

model CreateVoiceAppraiseResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateVoiceAppraiseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateVoiceAppraiseResponseBody(name='body'),
}

async function createVoiceAppraiseWithOptions(request: CreateVoiceAppraiseRequest, runtime: Util.RuntimeOptions): CreateVoiceAppraiseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowVersionId)) {
    query['ContactFlowVersionId'] = request.contactFlowVersionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isAppraise)) {
    query['IsAppraise'] = request.isAppraise;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateVoiceAppraise',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createVoiceAppraise(request: CreateVoiceAppraiseRequest): CreateVoiceAppraiseResponse {
  var runtime = new Util.RuntimeOptions{};
  return createVoiceAppraiseWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  instanceId?: string(name='InstanceId'),
}

model DeleteInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteInstanceResponseBody(name='body'),
}

async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DeleteMediaRequest {
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
}

model DeleteMediaResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteMediaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteMediaResponseBody(name='body'),
}

async function deleteMediaWithOptions(request: DeleteMediaRequest, runtime: Util.RuntimeOptions): DeleteMediaResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteMedia',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteMedia(request: DeleteMediaRequest): DeleteMediaResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteMediaWithOptions(request, runtime);
}

model DeletePhoneTagsRequest {
  instanceId?: string(name='InstanceId'),
  phoneNumberList?: [ string ](name='PhoneNumberList'),
}

model DeletePhoneTagsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeletePhoneTagsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePhoneTagsResponseBody(name='body'),
}

async function deletePhoneTagsWithOptions(request: DeletePhoneTagsRequest, runtime: Util.RuntimeOptions): DeletePhoneTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumberList)) {
    query['PhoneNumberList'] = request.phoneNumberList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeletePhoneTags',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePhoneTags(request: DeletePhoneTagsRequest): DeletePhoneTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return deletePhoneTagsWithOptions(request, runtime);
}

model DeleteSkillGroupRequest {
  instanceId?: string(name='InstanceId'),
  skillGroupId?: string(name='SkillGroupId'),
}

model DeleteSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteSkillGroupResponseBody(name='body'),
}

async function deleteSkillGroupWithOptions(request: DeleteSkillGroupRequest, runtime: Util.RuntimeOptions): DeleteSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteSkillGroup(request: DeleteSkillGroupRequest): DeleteSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSkillGroupWithOptions(request, runtime);
}

model DialExRequest {
  answerMode?: int32(name='AnswerMode'),
  callee?: string(name='Callee'),
  caller?: string(name='Caller'),
  instanceId?: string(name='InstanceId'),
  provider?: string(name='Provider'),
  routPoint?: string(name='RoutPoint'),
}

model DialExResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  statusCode?: string(name='StatusCode'),
  statusDesc?: string(name='StatusDesc'),
  success?: boolean(name='Success'),
  taskId?: string(name='TaskId'),
  timeStamp?: string(name='TimeStamp'),
}

model DialExResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DialExResponseBody(name='body'),
}

async function dialExWithOptions(request: DialExRequest, runtime: Util.RuntimeOptions): DialExResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.answerMode)) {
    query['AnswerMode'] = request.answerMode;
  }
  if (!Util.isUnset(request.callee)) {
    query['Callee'] = request.callee;
  }
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.provider)) {
    query['Provider'] = request.provider;
  }
  if (!Util.isUnset(request.routPoint)) {
    query['RoutPoint'] = request.routPoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DialEx',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function dialEx(request: DialExRequest): DialExResponse {
  var runtime = new Util.RuntimeOptions{};
  return dialExWithOptions(request, runtime);
}

model DisableTrunkProvidersRequest {
  providerName?: [ string ](name='ProviderName'),
}

model DisableTrunkProvidersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisableTrunkProvidersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisableTrunkProvidersResponseBody(name='body'),
}

async function disableTrunkProvidersWithOptions(request: DisableTrunkProvidersRequest, runtime: Util.RuntimeOptions): DisableTrunkProvidersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.providerName)) {
    query['ProviderName'] = request.providerName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableTrunkProviders',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disableTrunkProviders(request: DisableTrunkProvidersRequest): DisableTrunkProvidersResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableTrunkProvidersWithOptions(request, runtime);
}

model DownloadAllTypeRecordingRequest {
  channel?: string(name='Channel'),
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
}

model DownloadAllTypeRecordingResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  mediaDownloadParamList?: {
    mediaDownloadParam?: [ 
    {
      fileName?: string(name='FileName'),
      signatureUrl?: string(name='SignatureUrl'),
    }
  ](name='MediaDownloadParam')
  }(name='MediaDownloadParamList'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DownloadAllTypeRecordingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DownloadAllTypeRecordingResponseBody(name='body'),
}

async function downloadAllTypeRecordingWithOptions(request: DownloadAllTypeRecordingRequest, runtime: Util.RuntimeOptions): DownloadAllTypeRecordingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channel)) {
    query['Channel'] = request.channel;
  }
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DownloadAllTypeRecording',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function downloadAllTypeRecording(request: DownloadAllTypeRecordingRequest): DownloadAllTypeRecordingResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadAllTypeRecordingWithOptions(request, runtime);
}

model DownloadRecordingRequest {
  channel?: string(name='Channel'),
  fileName?: string(name='FileName'),
  instanceId?: string(name='InstanceId'),
}

model DownloadRecordingResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  mediaDownloadParam?: {
    fileName?: string(name='FileName'),
    signatureUrl?: string(name='SignatureUrl'),
  }(name='MediaDownloadParam'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DownloadRecordingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DownloadRecordingResponseBody(name='body'),
}

async function downloadRecordingWithOptions(request: DownloadRecordingRequest, runtime: Util.RuntimeOptions): DownloadRecordingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channel)) {
    query['Channel'] = request.channel;
  }
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DownloadRecording',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function downloadRecording(request: DownloadRecordingRequest): DownloadRecordingResponse {
  var runtime = new Util.RuntimeOptions{};
  return downloadRecordingWithOptions(request, runtime);
}

model FindUsersRequest {
  criteria?: string(name='Criteria'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model FindUsersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  users?: {
    list?: {
      user?: [ 
      {
        detail?: {
          department?: string(name='Department'),
          displayName?: string(name='DisplayName'),
          email?: string(name='Email'),
          loginName?: string(name='LoginName'),
          phone?: string(name='Phone'),
        }(name='Detail'),
        instanceId?: string(name='InstanceId'),
        privateOutboundNumberId?: string(name='PrivateOutboundNumberId'),
        ramId?: string(name='RamId'),
        roles?: {
          role?: [ 
          {
            instanceId?: string(name='InstanceId'),
            roleDescription?: string(name='RoleDescription'),
            roleId?: string(name='RoleId'),
            roleName?: string(name='RoleName'),
          }
        ](name='Role')
        }(name='Roles'),
        skillLevels?: {
          skillLevel?: [ 
          {
            level?: int32(name='Level'),
            skill?: {
              instanceId?: string(name='InstanceId'),
              skillGroupDescription?: string(name='SkillGroupDescription'),
              skillGroupId?: string(name='SkillGroupId'),
              skillGroupName?: string(name='SkillGroupName'),
            }(name='Skill'),
            skillLevelId?: string(name='SkillLevelId'),
          }
        ](name='SkillLevel')
        }(name='SkillLevels'),
        userId?: string(name='UserId'),
      }
    ](name='User')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Users'),
}

model FindUsersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: FindUsersResponseBody(name='body'),
}

async function findUsersWithOptions(request: FindUsersRequest, runtime: Util.RuntimeOptions): FindUsersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.criteria)) {
    query['Criteria'] = request.criteria;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'FindUsers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function findUsers(request: FindUsersRequest): FindUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return findUsersWithOptions(request, runtime);
}

model GenerateAgentStatisticReportRequest {
  agentId?: string(name='AgentId'),
  endDate?: string(name='EndDate'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startDate?: string(name='StartDate'),
}

model GenerateAgentStatisticReportResponseBody = {
  code?: string(name='Code'),
  dataList?: {
    list?: {
      generateAgentStatistic?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        averageReadyTime?: long(name='AverageReadyTime'),
        inbound?: {
          averageHoldTime?: long(name='AverageHoldTime'),
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsHandled?: long(name='CallsHandled'),
          callsOffered?: long(name='CallsOffered'),
          handleRate?: float(name='HandleRate'),
          maxHoldTime?: long(name='MaxHoldTime'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalHoldTime?: long(name='TotalHoldTime'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        loginName?: string(name='LoginName'),
        maxReadyTime?: long(name='MaxReadyTime'),
        occupancyRate?: float(name='OccupancyRate'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageHoldTime?: long(name='AverageHoldTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxHoldTime?: long(name='MaxHoldTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalHoldTime?: long(name='TotalHoldTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageHoldTime?: long(name='AverageHoldTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          maxHoldTime?: long(name='MaxHoldTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalCalls?: long(name='TotalCalls'),
          totalHoldTime?: long(name='TotalHoldTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        recordDate?: string(name='RecordDate'),
        skillGroupIds?: string(name='SkillGroupIds'),
        skillGroupNames?: string(name='SkillGroupNames'),
        totalBreakTime?: long(name='TotalBreakTime'),
        totalLoggedInTime?: long(name='TotalLoggedInTime'),
        totalReadyTime?: long(name='TotalReadyTime'),
      }
    ](name='GenerateAgentStatistic')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='DataList'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GenerateAgentStatisticReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GenerateAgentStatisticReportResponseBody(name='body'),
}

async function generateAgentStatisticReportWithOptions(request: GenerateAgentStatisticReportRequest, runtime: Util.RuntimeOptions): GenerateAgentStatisticReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentId)) {
    query['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GenerateAgentStatisticReport',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function generateAgentStatisticReport(request: GenerateAgentStatisticReportRequest): GenerateAgentStatisticReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return generateAgentStatisticReportWithOptions(request, runtime);
}

model GetAgentDataRequest {
  endDay?: string(name='EndDay'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startDay?: string(name='StartDay'),
  userId?: string(name='UserId'),
}

model GetAgentDataResponseBody = {
  code?: string(name='Code'),
  dataList?: {
    list?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        averageReadyTime?: long(name='AverageReadyTime'),
        inbound?: {
          averageHoldTime?: long(name='AverageHoldTime'),
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsHandled?: long(name='CallsHandled'),
          callsOffered?: long(name='CallsOffered'),
          handleRate?: float(name='HandleRate'),
          maxHoldTime?: long(name='MaxHoldTime'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalHoldTime?: long(name='TotalHoldTime'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        loginName?: string(name='LoginName'),
        maxReadyTime?: long(name='MaxReadyTime'),
        occupancyRate?: float(name='OccupancyRate'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageHoldTime?: long(name='AverageHoldTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxHoldTime?: long(name='MaxHoldTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalHoldTime?: long(name='TotalHoldTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageHoldTime?: long(name='AverageHoldTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          maxHoldTime?: long(name='MaxHoldTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalCalls?: long(name='TotalCalls'),
          totalHoldTime?: long(name='TotalHoldTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        recordDate?: string(name='RecordDate'),
        skillGroupIds?: string(name='SkillGroupIds'),
        skillGroupNames?: string(name='SkillGroupNames'),
        totalBreakTime?: long(name='TotalBreakTime'),
        totalLoggedInTime?: long(name='TotalLoggedInTime'),
        totalReadyTime?: long(name='TotalReadyTime'),
      }
    ](name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='DataList'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetAgentDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAgentDataResponseBody(name='body'),
}

async function getAgentDataWithOptions(request: GetAgentDataRequest, runtime: Util.RuntimeOptions): GetAgentDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endDay)) {
    query['EndDay'] = request.endDay;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startDay)) {
    query['StartDay'] = request.startDay;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAgentData',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAgentData(request: GetAgentDataRequest): GetAgentDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAgentDataWithOptions(request, runtime);
}

model GetCallMeasureSummaryReportRequest {
  day?: int32(name='Day'),
  intervalType?: string(name='IntervalType'),
  month?: int32(name='Month'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  year?: int32(name='Year'),
}

model GetCallMeasureSummaryReportResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  numberReports?: {
    list?: {
      numberReport?: [ 
      {
        day?: int32(name='Day'),
        inboundCount?: long(name='InboundCount'),
        inboundDurationByMinute?: long(name='InboundDurationByMinute'),
        month?: int32(name='Month'),
        number?: string(name='Number'),
        outboundCount?: long(name='OutboundCount'),
        outboundDurationByMinute?: long(name='OutboundDurationByMinute'),
        year?: int32(name='Year'),
      }
    ](name='NumberReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='NumberReports'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  summaryReport?: {
    day?: int32(name='Day'),
    inboundCount?: long(name='InboundCount'),
    inboundDurationByMinute?: long(name='InboundDurationByMinute'),
    month?: int32(name='Month'),
    outboundCount?: long(name='OutboundCount'),
    outboundDurationByMinute?: long(name='OutboundDurationByMinute'),
    year?: int32(name='Year'),
  }(name='SummaryReport'),
}

model GetCallMeasureSummaryReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetCallMeasureSummaryReportResponseBody(name='body'),
}

async function getCallMeasureSummaryReportWithOptions(request: GetCallMeasureSummaryReportRequest, runtime: Util.RuntimeOptions): GetCallMeasureSummaryReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.day)) {
    query['Day'] = request.day;
  }
  if (!Util.isUnset(request.intervalType)) {
    query['IntervalType'] = request.intervalType;
  }
  if (!Util.isUnset(request.month)) {
    query['Month'] = request.month;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.year)) {
    query['Year'] = request.year;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCallMeasureSummaryReport',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCallMeasureSummaryReport(request: GetCallMeasureSummaryReportRequest): GetCallMeasureSummaryReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCallMeasureSummaryReportWithOptions(request, runtime);
}

model GetConfigRequest {
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  objectId?: string(name='ObjectId'),
  objectType?: string(name='ObjectType'),
}

model GetConfigResponseBody = {
  code?: string(name='Code'),
  configItem?: {
    name?: string(name='Name'),
    value?: string(name='Value'),
  }(name='ConfigItem'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetConfigResponseBody(name='body'),
}

async function getConfigWithOptions(request: GetConfigRequest, runtime: Util.RuntimeOptions): GetConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.objectId)) {
    query['ObjectId'] = request.objectId;
  }
  if (!Util.isUnset(request.objectType)) {
    query['ObjectType'] = request.objectType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConfig',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getConfig(request: GetConfigRequest): GetConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConfigWithOptions(request, runtime);
}

model GetConversationDetailByContactIdRequest {
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model GetConversationDetailByContactIdResponseBody = {
  code?: string(name='Code'),
  dataList?: {
    list?: {
      qualityCheckPhrase?: [ 
      {
        begin?: long(name='Begin'),
        end?: long(name='End'),
        identity?: string(name='Identity'),
        role?: string(name='Role'),
        words?: string(name='Words'),
      }
    ](name='QualityCheckPhrase')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='DataList'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetConversationDetailByContactIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetConversationDetailByContactIdResponseBody(name='body'),
}

async function getConversationDetailByContactIdWithOptions(request: GetConversationDetailByContactIdRequest, runtime: Util.RuntimeOptions): GetConversationDetailByContactIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConversationDetailByContactId',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getConversationDetailByContactId(request: GetConversationDetailByContactIdRequest): GetConversationDetailByContactIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConversationDetailByContactIdWithOptions(request, runtime);
}

model GetInstanceRequest {
  instanceId?: string(name='InstanceId'),
}

model GetInstanceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  instance?: {
    admin?: {
      user?: [ 
      {
        detail?: {
          department?: string(name='Department'),
          displayName?: string(name='DisplayName'),
          email?: string(name='Email'),
          loginName?: string(name='LoginName'),
          phone?: string(name='Phone'),
        }(name='Detail'),
        instanceId?: string(name='InstanceId'),
        ramId?: string(name='RamId'),
        userId?: string(name='UserId'),
      }
    ](name='User')
    }(name='Admin'),
    consoleUrl?: string(name='ConsoleUrl'),
    createdTime?: long(name='CreatedTime'),
    directoryId?: string(name='DirectoryId'),
    domainName?: string(name='DomainName'),
    instanceDescription?: string(name='InstanceDescription'),
    instanceId?: string(name='InstanceId'),
    instanceName?: string(name='InstanceName'),
    maxOnlineAgents?: int32(name='MaxOnlineAgents'),
    owner?: string(name='Owner'),
    phoneNumbers?: {
      phoneNumber?: [ 
      {
        allowOutbound?: boolean(name='AllowOutbound'),
        instanceId?: string(name='InstanceId'),
        number?: string(name='Number'),
        phoneNumberDescription?: string(name='PhoneNumberDescription'),
        phoneNumberId?: string(name='PhoneNumberId'),
        remainingTime?: int32(name='RemainingTime'),
        testOnly?: boolean(name='TestOnly'),
        trunks?: int32(name='Trunks'),
        usage?: string(name='Usage'),
      }
    ](name='PhoneNumber')
    }(name='PhoneNumbers'),
    status?: string(name='Status'),
    storageBucket?: string(name='StorageBucket'),
    storageMaxDays?: int32(name='StorageMaxDays'),
    storageMaxSize?: int32(name='StorageMaxSize'),
    tenantId?: string(name='TenantId'),
  }(name='Instance'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceResponseBody(name='body'),
}

async function getInstanceWithOptions(request: GetInstanceRequest, runtime: Util.RuntimeOptions): GetInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstance',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstance(request: GetInstanceRequest): GetInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceWithOptions(request, runtime);
}

model GetInstanceStateRequest {
  instanceId?: string(name='InstanceId'),
}

model GetInstanceStateResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  realTimeInstanceState?: {
    agentStateDistributions?: {
      agentStateCount?: [ 
      {
        count?: long(name='Count'),
        state?: string(name='State'),
      }
    ](name='AgentStateCount')
    }(name='AgentStateDistributions'),
  }(name='RealTimeInstanceState'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetInstanceStateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceStateResponseBody(name='body'),
}

async function getInstanceStateWithOptions(request: GetInstanceStateRequest, runtime: Util.RuntimeOptions): GetInstanceStateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceState',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceState(request: GetInstanceStateRequest): GetInstanceStateResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceStateWithOptions(request, runtime);
}

model GetInstanceSummaryReportRequest {
  endTime?: string(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startTime?: string(name='StartTime'),
}

model GetInstanceSummaryReportResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  instanceSummaryReport?: {
    inbound?: {
      averageRingTime?: long(name='AverageRingTime'),
      averageTalkTime?: long(name='AverageTalkTime'),
      averageWaitTime?: long(name='AverageWaitTime'),
      averageWorkTime?: long(name='AverageWorkTime'),
      callsAbandonedInIVR?: long(name='CallsAbandonedInIVR'),
      callsAbandonedInQueue?: long(name='CallsAbandonedInQueue'),
      callsHandled?: long(name='CallsHandled'),
      callsIncomingIVR?: long(name='CallsIncomingIVR'),
      callsIncomingLine?: long(name='CallsIncomingLine'),
      callsIncomingQueue?: long(name='CallsIncomingQueue'),
      callsOffered?: long(name='CallsOffered'),
      handleRate?: float(name='HandleRate'),
      maxRingTime?: long(name='MaxRingTime'),
      maxTalkTime?: string(name='MaxTalkTime'),
      maxWaitTime?: long(name='MaxWaitTime'),
      maxWorkTime?: long(name='MaxWorkTime'),
      satisfactionIndex?: float(name='SatisfactionIndex'),
      satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
      satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
      serviceLevel20?: float(name='ServiceLevel20'),
      totalRingTime?: long(name='TotalRingTime'),
      totalTalkTime?: long(name='TotalTalkTime'),
      totalWaitTime?: long(name='TotalWaitTime'),
      totalWorkTime?: long(name='TotalWorkTime'),
    }(name='Inbound'),
    instanceId?: string(name='InstanceId'),
    outbound?: {
      answerRate?: float(name='AnswerRate'),
      averageDialingTime?: long(name='AverageDialingTime'),
      averageTalkTime?: long(name='AverageTalkTime'),
      averageWorkTime?: long(name='AverageWorkTime'),
      callsAnswered?: long(name='CallsAnswered'),
      callsDialed?: long(name='CallsDialed'),
      maxDialingTime?: long(name='MaxDialingTime'),
      maxTalkTime?: long(name='MaxTalkTime'),
      maxWorkTime?: long(name='MaxWorkTime'),
      satisfactionIndex?: float(name='SatisfactionIndex'),
      satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
      satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
      totalDialingTime?: long(name='TotalDialingTime'),
      totalTalkTime?: long(name='TotalTalkTime'),
      totalWorkTime?: long(name='TotalWorkTime'),
    }(name='Outbound'),
    overall?: {
      averageReadyTime?: long(name='AverageReadyTime'),
      averageTalkTime?: long(name='AverageTalkTime'),
      averageWorkTime?: long(name='AverageWorkTime'),
      maxReadyTime?: long(name='MaxReadyTime'),
      maxTalkTime?: long(name='MaxTalkTime'),
      maxWorkTime?: long(name='MaxWorkTime'),
      occupancyRate?: float(name='OccupancyRate'),
      satisfactionIndex?: float(name='SatisfactionIndex'),
      satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
      satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
      totalBreakTime?: long(name='TotalBreakTime'),
      totalCalls?: long(name='TotalCalls'),
      totalLoggedInTime?: long(name='TotalLoggedInTime'),
      totalReadyTime?: long(name='TotalReadyTime'),
      totalTalkTime?: long(name='TotalTalkTime'),
      totalWorkTime?: long(name='TotalWorkTime'),
    }(name='Overall'),
  }(name='InstanceSummaryReport'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetInstanceSummaryReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceSummaryReportResponseBody(name='body'),
}

async function getInstanceSummaryReportWithOptions(request: GetInstanceSummaryReportRequest, runtime: Util.RuntimeOptions): GetInstanceSummaryReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceSummaryReport',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceSummaryReport(request: GetInstanceSummaryReportRequest): GetInstanceSummaryReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceSummaryReportWithOptions(request, runtime);
}

model GetInstanceSummaryReportByIntervalRequest {
  endTime?: string(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  interval?: string(name='Interval'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startTime?: string(name='StartTime'),
}

model GetInstanceSummaryReportByIntervalResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  instanceTimeIntervalReport?: {
    instanceId?: string(name='InstanceId'),
    intervalList?: {
      instanceSummaryReport?: [ 
      {
        inbound?: {
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWaitTime?: long(name='AverageWaitTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAbandonedInIVR?: long(name='CallsAbandonedInIVR'),
          callsAbandonedInQueue?: long(name='CallsAbandonedInQueue'),
          callsHandled?: long(name='CallsHandled'),
          callsIncomingIVR?: long(name='CallsIncomingIVR'),
          callsIncomingLine?: long(name='CallsIncomingLine'),
          callsIncomingQueue?: long(name='CallsIncomingQueue'),
          callsOffered?: long(name='CallsOffered'),
          handleRate?: float(name='HandleRate'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: string(name='MaxTalkTime'),
          maxWaitTime?: long(name='MaxWaitTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          serviceLevel20?: float(name='ServiceLevel20'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWaitTime?: long(name='TotalWaitTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageReadyTime?: long(name='AverageReadyTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          maxReadyTime?: long(name='MaxReadyTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          occupancyRate?: float(name='OccupancyRate'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalBreakTime?: long(name='TotalBreakTime'),
          totalCalls?: long(name='TotalCalls'),
          totalLoggedInTime?: long(name='TotalLoggedInTime'),
          totalReadyTime?: long(name='TotalReadyTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        timestamp?: string(name='Timestamp'),
      }
    ](name='InstanceSummaryReport')
    }(name='IntervalList'),
  }(name='InstanceTimeIntervalReport'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetInstanceSummaryReportByIntervalResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceSummaryReportByIntervalResponseBody(name='body'),
}

async function getInstanceSummaryReportByIntervalWithOptions(request: GetInstanceSummaryReportByIntervalRequest, runtime: Util.RuntimeOptions): GetInstanceSummaryReportByIntervalResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceSummaryReportByInterval',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceSummaryReportByInterval(request: GetInstanceSummaryReportByIntervalRequest): GetInstanceSummaryReportByIntervalResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceSummaryReportByIntervalWithOptions(request, runtime);
}

model GetInstanceSummaryReportSinceMidnightRequest {
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model GetInstanceSummaryReportSinceMidnightResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  instanceSummaryReport?: {
    inbound?: {
      averageRingTime?: long(name='AverageRingTime'),
      averageTalkTime?: long(name='AverageTalkTime'),
      averageWaitTime?: long(name='AverageWaitTime'),
      averageWorkTime?: long(name='AverageWorkTime'),
      callsAbandonedInIVR?: long(name='CallsAbandonedInIVR'),
      callsAbandonedInQueue?: long(name='CallsAbandonedInQueue'),
      callsHandled?: long(name='CallsHandled'),
      callsIncomingIVR?: long(name='CallsIncomingIVR'),
      callsIncomingLine?: long(name='CallsIncomingLine'),
      callsIncomingQueue?: long(name='CallsIncomingQueue'),
      callsOffered?: long(name='CallsOffered'),
      handleRate?: float(name='HandleRate'),
      maxRingTime?: long(name='MaxRingTime'),
      maxTalkTime?: string(name='MaxTalkTime'),
      maxWaitTime?: long(name='MaxWaitTime'),
      maxWorkTime?: long(name='MaxWorkTime'),
      satisfactionIndex?: float(name='SatisfactionIndex'),
      satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
      satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
      serviceLevel20?: float(name='ServiceLevel20'),
      totalRingTime?: long(name='TotalRingTime'),
      totalTalkTime?: long(name='TotalTalkTime'),
      totalWaitTime?: long(name='TotalWaitTime'),
      totalWorkTime?: long(name='TotalWorkTime'),
    }(name='Inbound'),
    instanceId?: string(name='InstanceId'),
    outbound?: {
      answerRate?: float(name='AnswerRate'),
      averageDialingTime?: long(name='AverageDialingTime'),
      averageTalkTime?: long(name='AverageTalkTime'),
      averageWorkTime?: long(name='AverageWorkTime'),
      callsAnswered?: long(name='CallsAnswered'),
      callsDialed?: long(name='CallsDialed'),
      maxDialingTime?: long(name='MaxDialingTime'),
      maxTalkTime?: long(name='MaxTalkTime'),
      maxWorkTime?: long(name='MaxWorkTime'),
      satisfactionIndex?: float(name='SatisfactionIndex'),
      satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
      satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
      totalDialingTime?: long(name='TotalDialingTime'),
      totalTalkTime?: long(name='TotalTalkTime'),
      totalWorkTime?: long(name='TotalWorkTime'),
    }(name='Outbound'),
    overall?: {
      averageReadyTime?: long(name='AverageReadyTime'),
      averageTalkTime?: long(name='AverageTalkTime'),
      averageWorkTime?: long(name='AverageWorkTime'),
      maxReadyTime?: long(name='MaxReadyTime'),
      maxTalkTime?: long(name='MaxTalkTime'),
      maxWorkTime?: long(name='MaxWorkTime'),
      occupancyRate?: float(name='OccupancyRate'),
      satisfactionIndex?: float(name='SatisfactionIndex'),
      satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
      satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
      totalBreakTime?: long(name='TotalBreakTime'),
      totalCalls?: long(name='TotalCalls'),
      totalLoggedInTime?: long(name='TotalLoggedInTime'),
      totalReadyTime?: long(name='TotalReadyTime'),
      totalTalkTime?: long(name='TotalTalkTime'),
      totalWorkTime?: long(name='TotalWorkTime'),
    }(name='Overall'),
    timestamp?: string(name='Timestamp'),
  }(name='InstanceSummaryReport'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetInstanceSummaryReportSinceMidnightResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceSummaryReportSinceMidnightResponseBody(name='body'),
}

async function getInstanceSummaryReportSinceMidnightWithOptions(request: GetInstanceSummaryReportSinceMidnightRequest, runtime: Util.RuntimeOptions): GetInstanceSummaryReportSinceMidnightResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceSummaryReportSinceMidnight',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceSummaryReportSinceMidnight(request: GetInstanceSummaryReportSinceMidnightRequest): GetInstanceSummaryReportSinceMidnightResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceSummaryReportSinceMidnightWithOptions(request, runtime);
}

model GetNumberRegionInfoRequest {
  instanceId?: string(name='InstanceId'),
  number?: string(name='Number'),
}

model GetNumberRegionInfoResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  phoneNumber?: {
    city?: string(name='City'),
    number?: string(name='Number'),
    province?: string(name='Province'),
  }(name='PhoneNumber'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetNumberRegionInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetNumberRegionInfoResponseBody(name='body'),
}

async function getNumberRegionInfoWithOptions(request: GetNumberRegionInfoRequest, runtime: Util.RuntimeOptions): GetNumberRegionInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.number)) {
    query['Number'] = request.number;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetNumberRegionInfo',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getNumberRegionInfo(request: GetNumberRegionInfoRequest): GetNumberRegionInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return getNumberRegionInfoWithOptions(request, runtime);
}

model GetRecordOssUploadParamRequest {
  fileName?: string(name='FileName'),
  instanceId?: string(name='InstanceId'),
}

model GetRecordOssUploadParamResponseBody = {
  code?: string(name='Code'),
  dir?: string(name='Dir'),
  expires?: string(name='Expires'),
  host?: string(name='Host'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  ossAccessKeyId?: string(name='OssAccessKeyId'),
  ossFileName?: string(name='OssFileName'),
  policy?: string(name='Policy'),
  requestId?: string(name='RequestId'),
  signature?: string(name='Signature'),
  success?: boolean(name='Success'),
}

model GetRecordOssUploadParamResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetRecordOssUploadParamResponseBody(name='body'),
}

async function getRecordOssUploadParamWithOptions(request: GetRecordOssUploadParamRequest, runtime: Util.RuntimeOptions): GetRecordOssUploadParamResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRecordOssUploadParam',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRecordOssUploadParam(request: GetRecordOssUploadParamRequest): GetRecordOssUploadParamResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRecordOssUploadParamWithOptions(request, runtime);
}

model GetRoutePointRequest {
  contactFlowId?: string(name='ContactFlowId'),
  instanceId?: string(name='InstanceId'),
}

model GetRoutePointResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  routePoint?: string(name='RoutePoint'),
  success?: boolean(name='Success'),
}

model GetRoutePointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetRoutePointResponseBody(name='body'),
}

async function getRoutePointWithOptions(request: GetRoutePointRequest, runtime: Util.RuntimeOptions): GetRoutePointResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowId)) {
    query['ContactFlowId'] = request.contactFlowId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRoutePoint',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRoutePoint(request: GetRoutePointRequest): GetRoutePointResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRoutePointWithOptions(request, runtime);
}

model GetServiceExtensionsRequest {
  instanceId?: string(name='InstanceId'),
  serviceType?: string(name='ServiceType'),
}

model GetServiceExtensionsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  serviceExtensions?: {
    serviceExtension?: [ 
    {
      name?: string(name='Name'),
      number?: string(name='Number'),
    }
  ](name='ServiceExtension')
  }(name='ServiceExtensions'),
  success?: boolean(name='Success'),
}

model GetServiceExtensionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServiceExtensionsResponseBody(name='body'),
}

async function getServiceExtensionsWithOptions(request: GetServiceExtensionsRequest, runtime: Util.RuntimeOptions): GetServiceExtensionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.serviceType)) {
    query['ServiceType'] = request.serviceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetServiceExtensions',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getServiceExtensions(request: GetServiceExtensionsRequest): GetServiceExtensionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServiceExtensionsWithOptions(request, runtime);
}

model GetSmsConfigRequest {
  instanceId?: string(name='InstanceId'),
  scenario?: [ int32 ](name='Scenario'),
}

model GetSmsConfigResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  smsConfigs?: {
    smsConfig?: [ 
    {
      description?: string(name='Description'),
      extra?: string(name='Extra'),
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      id?: long(name='Id'),
      instance?: string(name='Instance'),
      name?: string(name='Name'),
      scenario?: int32(name='Scenario'),
      signName?: string(name='SignName'),
      templateCode?: string(name='TemplateCode'),
    }
  ](name='SmsConfig')
  }(name='SmsConfigs'),
  success?: boolean(name='Success'),
}

model GetSmsConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetSmsConfigResponseBody(name='body'),
}

async function getSmsConfigWithOptions(request: GetSmsConfigRequest, runtime: Util.RuntimeOptions): GetSmsConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.scenario)) {
    query['Scenario'] = request.scenario;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSmsConfig',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getSmsConfig(request: GetSmsConfigRequest): GetSmsConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSmsConfigWithOptions(request, runtime);
}

model GetTURNCredentialsRequest {
  instanceId?: string(name='InstanceId'),
  userName?: string(name='UserName'),
}

model GetTURNCredentialsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  password?: string(name='Password'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  username?: string(name='Username'),
}

model GetTURNCredentialsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTURNCredentialsResponseBody(name='body'),
}

async function getTURNCredentialsWithOptions(request: GetTURNCredentialsRequest, runtime: Util.RuntimeOptions): GetTURNCredentialsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTURNCredentials',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTURNCredentials(request: GetTURNCredentialsRequest): GetTURNCredentialsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTURNCredentialsWithOptions(request, runtime);
}

model GetTURNServerListRequest {
  instanceId?: string(name='InstanceId'),
}

model GetTURNServerListResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  turnServerListConfig?: string(name='TurnServerListConfig'),
}

model GetTURNServerListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTURNServerListResponseBody(name='body'),
}

async function getTURNServerListWithOptions(request: GetTURNServerListRequest, runtime: Util.RuntimeOptions): GetTURNServerListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTURNServerList',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTURNServerList(request: GetTURNServerListRequest): GetTURNServerListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTURNServerListWithOptions(request, runtime);
}

model GetUserRequest {
  instanceId?: string(name='InstanceId'),
  userId?: string(name='UserId'),
}

model GetUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  user?: {
    detail?: {
      department?: string(name='Department'),
      displayName?: string(name='DisplayName'),
      email?: string(name='Email'),
      loginName?: string(name='LoginName'),
      phone?: string(name='Phone'),
    }(name='Detail'),
    instanceId?: string(name='InstanceId'),
    ramId?: string(name='RamId'),
    roles?: {
      role?: [ 
      {
        instanceId?: string(name='InstanceId'),
        roleDescription?: string(name='RoleDescription'),
        roleId?: string(name='RoleId'),
        roleName?: string(name='RoleName'),
      }
    ](name='Role')
    }(name='Roles'),
    skillLevels?: {
      skillLevel?: [ 
      {
        level?: int32(name='Level'),
        skill?: {
          instanceId?: string(name='InstanceId'),
          skillGroupDescription?: string(name='SkillGroupDescription'),
          skillGroupId?: string(name='SkillGroupId'),
          skillGroupName?: string(name='SkillGroupName'),
        }(name='Skill'),
        skillLevelId?: string(name='SkillLevelId'),
      }
    ](name='SkillLevel')
    }(name='SkillLevels'),
    userId?: string(name='UserId'),
  }(name='User'),
}

model GetUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserResponseBody(name='body'),
}

async function getUserWithOptions(request: GetUserRequest, runtime: Util.RuntimeOptions): GetUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUser(request: GetUserRequest): GetUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUserWithOptions(request, runtime);
}

model GetUserByExtensionRequest {
  extension?: string(name='Extension'),
  instanceId?: string(name='InstanceId'),
}

model GetUserByExtensionResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  user?: {
    detail?: {
      department?: string(name='Department'),
      displayName?: string(name='DisplayName'),
      email?: string(name='Email'),
      extension?: string(name='Extension'),
      loginName?: string(name='LoginName'),
      phone?: string(name='Phone'),
    }(name='Detail'),
    instanceId?: string(name='InstanceId'),
    ramId?: string(name='RamId'),
    roles?: [ 
      {
        instanceId?: string(name='InstanceId'),
        roleDescription?: string(name='RoleDescription'),
        roleId?: string(name='RoleId'),
        roleName?: string(name='RoleName'),
      }
    ](name='Roles'),
    skillLevels?: [ 
      {
        level?: int32(name='Level'),
        skill?: {
          instanceId?: string(name='InstanceId'),
          skillGroupDescription?: string(name='SkillGroupDescription'),
          skillGroupId?: string(name='SkillGroupId'),
          skillGroupName?: string(name='SkillGroupName'),
        }(name='Skill'),
        skillLevelId?: string(name='SkillLevelId'),
      }
    ](name='SkillLevels'),
    userId?: string(name='UserId'),
  }(name='User'),
}

model GetUserByExtensionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserByExtensionResponseBody(name='body'),
}

async function getUserByExtensionWithOptions(request: GetUserByExtensionRequest, runtime: Util.RuntimeOptions): GetUserByExtensionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.extension)) {
    query['Extension'] = request.extension;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUserByExtension',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUserByExtension(request: GetUserByExtensionRequest): GetUserByExtensionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUserByExtensionWithOptions(request, runtime);
}

model LaunchAppraiseRequest {
  acid?: string(name='Acid'),
  instanceId?: string(name='InstanceId'),
}

model LaunchAppraiseResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model LaunchAppraiseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: LaunchAppraiseResponseBody(name='body'),
}

async function launchAppraiseWithOptions(request: LaunchAppraiseRequest, runtime: Util.RuntimeOptions): LaunchAppraiseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.acid)) {
    query['Acid'] = request.acid;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'LaunchAppraise',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function launchAppraise(request: LaunchAppraiseRequest): LaunchAppraiseResponse {
  var runtime = new Util.RuntimeOptions{};
  return launchAppraiseWithOptions(request, runtime);
}

model LaunchShortMessageAppraiseRequest {
  acid?: string(name='Acid'),
  contactType?: int32(name='ContactType'),
  instanceId?: string(name='InstanceId'),
  phoneNumbers?: string(name='PhoneNumbers'),
  skillGroupId?: string(name='SkillGroupId'),
}

model LaunchShortMessageAppraiseResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model LaunchShortMessageAppraiseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: LaunchShortMessageAppraiseResponseBody(name='body'),
}

async function launchShortMessageAppraiseWithOptions(request: LaunchShortMessageAppraiseRequest, runtime: Util.RuntimeOptions): LaunchShortMessageAppraiseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.acid)) {
    query['Acid'] = request.acid;
  }
  if (!Util.isUnset(request.contactType)) {
    query['ContactType'] = request.contactType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumbers)) {
    query['PhoneNumbers'] = request.phoneNumbers;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'LaunchShortMessageAppraise',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function launchShortMessageAppraise(request: LaunchShortMessageAppraiseRequest): LaunchShortMessageAppraiseResponse {
  var runtime = new Util.RuntimeOptions{};
  return launchShortMessageAppraiseWithOptions(request, runtime);
}

model ListAgentDevicesRequest {
  instanceId?: string(name='InstanceId'),
  ramIds?: string(name='RamIds'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
}

model ListAgentDevicesResponseBody = {
  agentDeviceList?: {
    agentDevice?: [ 
    {
      browserVersion?: string(name='BrowserVersion'),
      clientIp?: string(name='ClientIp'),
      clientPort?: string(name='ClientPort'),
      instanceId?: string(name='InstanceId'),
      isLogin?: int32(name='IsLogin'),
      loginTime?: long(name='LoginTime'),
      ramId?: long(name='RamId'),
      remark?: string(name='Remark'),
    }
  ](name='AgentDevice')
  }(name='AgentDeviceList'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentDevicesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentDevicesResponseBody(name='body'),
}

async function listAgentDevicesWithOptions(request: ListAgentDevicesRequest, runtime: Util.RuntimeOptions): ListAgentDevicesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ramIds)) {
    query['RamIds'] = request.ramIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentDevices',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentDevices(request: ListAgentDevicesRequest): ListAgentDevicesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentDevicesWithOptions(request, runtime);
}

model ListAgentEventsRequest {
  event?: [ string ](name='Event'),
  instanceId?: string(name='InstanceId'),
  ramId?: [ string ](name='RamId'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
}

model ListAgentEventsResponseBody = {
  agentEventList?: {
    agentEvent?: [ 
    {
      event?: string(name='Event'),
      eventTime?: long(name='EventTime'),
      instanceId?: string(name='InstanceId'),
      loginName?: string(name='LoginName'),
      ramId?: long(name='RamId'),
      skillGroupIds?: {
        skillGroup?: [ 
        {
          skillGroupId?: string(name='SkillGroupId'),
          skillGroupName?: string(name='SkillGroupName'),
        }
      ](name='SkillGroup')
      }(name='SkillGroupIds'),
    }
  ](name='AgentEvent')
  }(name='AgentEventList'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentEventsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentEventsResponseBody(name='body'),
}

async function listAgentEventsWithOptions(request: ListAgentEventsRequest, runtime: Util.RuntimeOptions): ListAgentEventsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.event)) {
    query['Event'] = request.event;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ramId)) {
    query['RamId'] = request.ramId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentEvents',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentEvents(request: ListAgentEventsRequest): ListAgentEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentEventsWithOptions(request, runtime);
}

model ListAgentStateLogsRequest {
  endTime?: long(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  ramId?: long(name='RamId'),
  startTime?: long(name='StartTime'),
}

model ListAgentStateLogsResponseBody = {
  agentStateLogPage?: {
    list?: [ 
      {
        connectId?: string(name='ConnectId'),
        contactId?: string(name='ContactId'),
        counterParty?: string(name='CounterParty'),
        instanceId?: string(name='InstanceId'),
        ramId?: long(name='RamId'),
        skillGroupIds?: string(name='SkillGroupIds'),
        state?: string(name='State'),
        stateCode?: string(name='StateCode'),
        stateTime?: long(name='StateTime'),
      }
    ](name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='AgentStateLogPage'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentStateLogsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentStateLogsResponseBody(name='body'),
}

async function listAgentStateLogsWithOptions(request: ListAgentStateLogsRequest, runtime: Util.RuntimeOptions): ListAgentStateLogsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.ramId)) {
    query['RamId'] = request.ramId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentStateLogs',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentStateLogs(request: ListAgentStateLogsRequest): ListAgentStateLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentStateLogsWithOptions(request, runtime);
}

model ListAgentStatesRequest {
  agentIds?: string(name='AgentIds'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupId?: string(name='SkillGroupId'),
  state?: string(name='State'),
}

model ListAgentStatesResponseBody = {
  code?: string(name='Code'),
  data?: {
    list?: {
      realTimeAgentState?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        dn?: string(name='Dn'),
        instanceId?: string(name='InstanceId'),
        loginName?: string(name='LoginName'),
        state?: string(name='State'),
        stateDuration?: string(name='StateDuration'),
      }
    ](name='RealTimeAgentState')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentStatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentStatesResponseBody(name='body'),
}

async function listAgentStatesWithOptions(request: ListAgentStatesRequest, runtime: Util.RuntimeOptions): ListAgentStatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentIds)) {
    query['AgentIds'] = request.agentIds;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.state)) {
    query['State'] = request.state;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentStates',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentStates(request: ListAgentStatesRequest): ListAgentStatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentStatesWithOptions(request, runtime);
}

model ListAgentSummaryReportsRequest {
  agentIds?: string(name='AgentIds'),
  endTime?: string(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupId?: string(name='SkillGroupId'),
  startTime?: string(name='StartTime'),
}

model ListAgentSummaryReportsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pagedAgentSummaryReport?: {
    list?: {
      agentSummaryReport?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        inbound?: {
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsHandled?: long(name='CallsHandled'),
          callsOffered?: long(name='CallsOffered'),
          handleRate?: float(name='HandleRate'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          serviceLevel20?: float(name='ServiceLevel20'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        loginName?: string(name='LoginName'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: string(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageReadyTime?: long(name='AverageReadyTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          firstLogInTime?: string(name='FirstLogInTime'),
          lastLogOutTime?: string(name='LastLogOutTime'),
          maxReadyTime?: long(name='MaxReadyTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          occupancyRate?: float(name='OccupancyRate'),
          oneTransferCalls?: long(name='OneTransferCalls'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalBreakTime?: long(name='TotalBreakTime'),
          totalCalls?: long(name='TotalCalls'),
          totalLoggedInTime?: long(name='TotalLoggedInTime'),
          totalReadyTime?: long(name='TotalReadyTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        skillGroupIds?: string(name='SkillGroupIds'),
        skillGroupNames?: string(name='SkillGroupNames'),
      }
    ](name='AgentSummaryReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PagedAgentSummaryReport'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentSummaryReportsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentSummaryReportsResponseBody(name='body'),
}

async function listAgentSummaryReportsWithOptions(request: ListAgentSummaryReportsRequest, runtime: Util.RuntimeOptions): ListAgentSummaryReportsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentIds)) {
    query['AgentIds'] = request.agentIds;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentSummaryReports',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentSummaryReports(request: ListAgentSummaryReportsRequest): ListAgentSummaryReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentSummaryReportsWithOptions(request, runtime);
}

model ListAgentSummaryReportsByIntervalRequest {
  agentIds?: string(name='AgentIds'),
  endTime?: string(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  interval?: string(name='Interval'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupId?: string(name='SkillGroupId'),
  startTime?: string(name='StartTime'),
}

model ListAgentSummaryReportsByIntervalResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pagedAgentSummaryReport?: {
    list?: {
      agentTimeIntervalReport?: [ 
      {
        agentId?: string(name='AgentId'),
        intervalList?: {
          agentSummaryReport?: [ 
          {
            agentId?: string(name='AgentId'),
            agentName?: string(name='AgentName'),
            inbound?: {
              averageRingTime?: long(name='AverageRingTime'),
              averageTalkTime?: long(name='AverageTalkTime'),
              averageWorkTime?: long(name='AverageWorkTime'),
              callsHandled?: long(name='CallsHandled'),
              callsOffered?: long(name='CallsOffered'),
              handleRate?: float(name='HandleRate'),
              maxRingTime?: long(name='MaxRingTime'),
              maxTalkTime?: long(name='MaxTalkTime'),
              maxWorkTime?: long(name='MaxWorkTime'),
              satisfactionIndex?: float(name='SatisfactionIndex'),
              satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
              satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
              serviceLevel20?: float(name='ServiceLevel20'),
              totalRingTime?: long(name='TotalRingTime'),
              totalTalkTime?: long(name='TotalTalkTime'),
              totalWorkTime?: long(name='TotalWorkTime'),
            }(name='Inbound'),
            instanceId?: string(name='InstanceId'),
            loginName?: string(name='LoginName'),
            outbound?: {
              answerRate?: float(name='AnswerRate'),
              averageDialingTime?: long(name='AverageDialingTime'),
              averageTalkTime?: long(name='AverageTalkTime'),
              averageWorkTime?: long(name='AverageWorkTime'),
              callsAnswered?: long(name='CallsAnswered'),
              callsDialed?: long(name='CallsDialed'),
              maxDialingTime?: long(name='MaxDialingTime'),
              maxTalkTime?: long(name='MaxTalkTime'),
              maxWorkTime?: long(name='MaxWorkTime'),
              satisfactionIndex?: float(name='SatisfactionIndex'),
              satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
              satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
              totalDialingTime?: long(name='TotalDialingTime'),
              totalTalkTime?: long(name='TotalTalkTime'),
              totalWorkTime?: long(name='TotalWorkTime'),
            }(name='Outbound'),
            overall?: {
              averageReadyTime?: long(name='AverageReadyTime'),
              averageTalkTime?: long(name='AverageTalkTime'),
              averageWorkTime?: long(name='AverageWorkTime'),
              firstLogInTime?: string(name='FirstLogInTime'),
              lastLogOutTime?: string(name='LastLogOutTime'),
              maxReadyTime?: long(name='MaxReadyTime'),
              maxTalkTime?: long(name='MaxTalkTime'),
              maxWorkTime?: long(name='MaxWorkTime'),
              occupancyRate?: float(name='OccupancyRate'),
              oneTransferCalls?: long(name='OneTransferCalls'),
              satisfactionIndex?: float(name='SatisfactionIndex'),
              satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
              satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
              totalBreakTime?: long(name='TotalBreakTime'),
              totalCalls?: long(name='TotalCalls'),
              totalLoggedInTime?: long(name='TotalLoggedInTime'),
              totalReadyTime?: long(name='TotalReadyTime'),
              totalTalkTime?: long(name='TotalTalkTime'),
              totalWorkTime?: long(name='TotalWorkTime'),
            }(name='Overall'),
            skillGroupIds?: string(name='SkillGroupIds'),
            skillGroupNames?: string(name='SkillGroupNames'),
            timestamp?: string(name='Timestamp'),
          }
        ](name='AgentSummaryReport')
        }(name='IntervalList'),
      }
    ](name='AgentTimeIntervalReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PagedAgentSummaryReport'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentSummaryReportsByIntervalResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentSummaryReportsByIntervalResponseBody(name='body'),
}

async function listAgentSummaryReportsByIntervalWithOptions(request: ListAgentSummaryReportsByIntervalRequest, runtime: Util.RuntimeOptions): ListAgentSummaryReportsByIntervalResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentIds)) {
    query['AgentIds'] = request.agentIds;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentSummaryReportsByInterval',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentSummaryReportsByInterval(request: ListAgentSummaryReportsByIntervalRequest): ListAgentSummaryReportsByIntervalResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentSummaryReportsByIntervalWithOptions(request, runtime);
}

model ListAgentSummaryReportsSinceMidnightRequest {
  agentIds?: string(name='AgentIds'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupId?: string(name='SkillGroupId'),
}

model ListAgentSummaryReportsSinceMidnightResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pagedAgentSummaryReport?: {
    list?: {
      agentSummaryReport?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        inbound?: {
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsHandled?: long(name='CallsHandled'),
          callsOffered?: long(name='CallsOffered'),
          handleRate?: float(name='HandleRate'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          serviceLevel20?: float(name='ServiceLevel20'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        loginName?: string(name='LoginName'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: string(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageReadyTime?: long(name='AverageReadyTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          maxReadyTime?: long(name='MaxReadyTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          occupancyRate?: float(name='OccupancyRate'),
          oneTransferCalls?: long(name='OneTransferCalls'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalBreakTime?: long(name='TotalBreakTime'),
          totalCalls?: long(name='TotalCalls'),
          totalLoggedInTime?: long(name='TotalLoggedInTime'),
          totalReadyTime?: long(name='TotalReadyTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        skillGroupIds?: string(name='SkillGroupIds'),
        skillGroupNames?: string(name='SkillGroupNames'),
        timestamp?: string(name='Timestamp'),
      }
    ](name='AgentSummaryReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PagedAgentSummaryReport'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentSummaryReportsSinceMidnightResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentSummaryReportsSinceMidnightResponseBody(name='body'),
}

async function listAgentSummaryReportsSinceMidnightWithOptions(request: ListAgentSummaryReportsSinceMidnightRequest, runtime: Util.RuntimeOptions): ListAgentSummaryReportsSinceMidnightResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentIds)) {
    query['AgentIds'] = request.agentIds;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentSummaryReportsSinceMidnight',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentSummaryReportsSinceMidnight(request: ListAgentSummaryReportsSinceMidnightRequest): ListAgentSummaryReportsSinceMidnightResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentSummaryReportsSinceMidnightWithOptions(request, runtime);
}

model ListCallDetailRecordsRequest {
  contactDisposition?: string(name='ContactDisposition'),
  contactId?: string(name='ContactId'),
  contactType?: string(name='ContactType'),
  criteria?: string(name='Criteria'),
  instanceId?: string(name='InstanceId'),
  orderBy?: string(name='OrderBy'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  phoneNumber?: string(name='PhoneNumber'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
  withRecording?: boolean(name='WithRecording'),
}

model ListCallDetailRecordsResponseBody = {
  callDetailRecords?: {
    list?: {
      callDetailRecord?: [ 
      {
        agentNames?: string(name='AgentNames'),
        agents?: {
          callDetailAgent?: [ 
          {
            agentId?: string(name='AgentId'),
            feedback?: string(name='Feedback'),
            satisfaction?: string(name='Satisfaction'),
          }
        ](name='CallDetailAgent')
        }(name='Agents'),
        calledNumber?: string(name='CalledNumber'),
        callingNumber?: string(name='CallingNumber'),
        contactDisposition?: string(name='ContactDisposition'),
        contactId?: string(name='ContactId'),
        contactType?: string(name='ContactType'),
        duration?: int32(name='Duration'),
        feedback?: string(name='Feedback'),
        instanceId?: string(name='InstanceId'),
        recordings?: {
          recording?: [ 
          {
            agentId?: string(name='AgentId'),
            agentName?: string(name='AgentName'),
            contactId?: string(name='ContactId'),
            duration?: int32(name='Duration'),
            fileDescription?: string(name='FileDescription'),
            fileName?: string(name='FileName'),
            qualityCheckTaskId?: string(name='QualityCheckTaskId'),
            qualityCheckTid?: string(name='QualityCheckTid'),
            startTime?: long(name='StartTime'),
          }
        ](name='Recording')
        }(name='Recordings'),
        satisfaction?: int32(name='Satisfaction'),
        satisfactionDesc?: string(name='SatisfactionDesc'),
        skillGroupIdList?: string(name='SkillGroupIdList'),
        skillGroupNames?: string(name='SkillGroupNames'),
        startTime?: long(name='StartTime'),
      }
    ](name='CallDetailRecord')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='CallDetailRecords'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListCallDetailRecordsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCallDetailRecordsResponseBody(name='body'),
}

async function listCallDetailRecordsWithOptions(request: ListCallDetailRecordsRequest, runtime: Util.RuntimeOptions): ListCallDetailRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactDisposition)) {
    query['ContactDisposition'] = request.contactDisposition;
  }
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.contactType)) {
    query['ContactType'] = request.contactType;
  }
  if (!Util.isUnset(request.criteria)) {
    query['Criteria'] = request.criteria;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  if (!Util.isUnset(request.withRecording)) {
    query['WithRecording'] = request.withRecording;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCallDetailRecords',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCallDetailRecords(request: ListCallDetailRecordsRequest): ListCallDetailRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCallDetailRecordsWithOptions(request, runtime);
}

model ListCallEventDetailByContactIdRequest {
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
}

model ListCallEventDetailByContactIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    callType?: string(name='CallType'),
    callee?: string(name='Callee'),
    caller?: string(name='Caller'),
    events?: {
      callEventDetail?: [ 
      {
        agentName?: string(name='AgentName'),
        callMode?: string(name='CallMode'),
        detailData?: {
          eventType?: string(name='EventType'),
          hangUper?: string(name='HangUper'),
          helper?: string(name='Helper'),
          satisfactionalResearch?: string(name='SatisfactionalResearch'),
          skillGroup?: string(name='SkillGroup'),
        }(name='DetailData'),
        duration?: int32(name='Duration'),
        event?: string(name='Event'),
        status?: string(name='Status'),
        timeStamp?: string(name='TimeStamp'),
      }
    ](name='CallEventDetail')
    }(name='Events'),
    privacyNumber?: string(name='PrivacyNumber'),
    releaseAgent?: string(name='ReleaseAgent'),
    releaseReason?: string(name='ReleaseReason'),
    startTime?: string(name='StartTime'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListCallEventDetailByContactIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCallEventDetailByContactIdResponseBody(name='body'),
}

async function listCallEventDetailByContactIdWithOptions(request: ListCallEventDetailByContactIdRequest, runtime: Util.RuntimeOptions): ListCallEventDetailByContactIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCallEventDetailByContactId',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCallEventDetailByContactId(request: ListCallEventDetailByContactIdRequest): ListCallEventDetailByContactIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCallEventDetailByContactIdWithOptions(request, runtime);
}

model ListCallMeasureSummaryReportsRequest {
  intervalType?: string(name='IntervalType'),
}

model ListCallMeasureSummaryReportsResponseBody = {
  callMeasureSummaryReportList?: {
    callMeasureSummaryReport?: [ 
    {
      day?: string(name='Day'),
      inboundCount?: long(name='InboundCount'),
      inboundDurationByMinute?: long(name='InboundDurationByMinute'),
      month?: string(name='Month'),
      outboundCount?: long(name='OutboundCount'),
      outboundDurationByMinute?: long(name='OutboundDurationByMinute'),
      year?: string(name='Year'),
    }
  ](name='CallMeasureSummaryReport')
  }(name='CallMeasureSummaryReportList'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListCallMeasureSummaryReportsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCallMeasureSummaryReportsResponseBody(name='body'),
}

async function listCallMeasureSummaryReportsWithOptions(request: ListCallMeasureSummaryReportsRequest, runtime: Util.RuntimeOptions): ListCallMeasureSummaryReportsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.intervalType)) {
    query['IntervalType'] = request.intervalType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCallMeasureSummaryReports',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCallMeasureSummaryReports(request: ListCallMeasureSummaryReportsRequest): ListCallMeasureSummaryReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCallMeasureSummaryReportsWithOptions(request, runtime);
}

model ListConfigRequest {
  configItem?: [ string ](name='ConfigItem'),
  instanceId?: string(name='InstanceId'),
}

model ListConfigResponseBody = {
  code?: string(name='Code'),
  configItems?: {
    configItem?: [ 
    {
      name?: string(name='Name'),
      value?: string(name='Value'),
    }
  ](name='ConfigItem')
  }(name='ConfigItems'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListConfigResponseBody(name='body'),
}

async function listConfigWithOptions(request: ListConfigRequest, runtime: Util.RuntimeOptions): ListConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.configItem)) {
    query['ConfigItem'] = request.configItem;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListConfig',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listConfig(request: ListConfigRequest): ListConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return listConfigWithOptions(request, runtime);
}

model ListContactFlowsRequest {
  instanceId?: string(name='InstanceId'),
}

model ListContactFlowsResponseBody = {
  code?: string(name='Code'),
  contactFlows?: {
    contactFlow?: [ 
    {
      appliedVersion?: string(name='AppliedVersion'),
      contactFlowDescription?: string(name='ContactFlowDescription'),
      contactFlowId?: string(name='ContactFlowId'),
      contactFlowName?: string(name='ContactFlowName'),
      instanceId?: string(name='InstanceId'),
      phoneNumbers?: {
        phoneNumber?: [ 
        {
          allowOutbound?: boolean(name='AllowOutbound'),
          instanceId?: string(name='InstanceId'),
          number?: string(name='Number'),
          phoneNumberDescription?: string(name='PhoneNumberDescription'),
          phoneNumberId?: string(name='PhoneNumberId'),
          remainingTime?: int32(name='RemainingTime'),
          testOnly?: boolean(name='TestOnly'),
          trunks?: int32(name='Trunks'),
          usage?: string(name='Usage'),
        }
      ](name='PhoneNumber')
      }(name='PhoneNumbers'),
      type?: string(name='Type'),
      versions?: {
        contactFlowVersion?: [ 
        {
          contactFlowVersionDescription?: string(name='ContactFlowVersionDescription'),
          contactFlowVersionId?: string(name='ContactFlowVersionId'),
          lastModified?: string(name='LastModified'),
          lastModifiedBy?: string(name='LastModifiedBy'),
          lockedBy?: string(name='LockedBy'),
          status?: string(name='Status'),
          version?: string(name='Version'),
        }
      ](name='ContactFlowVersion')
      }(name='Versions'),
    }
  ](name='ContactFlow')
  }(name='ContactFlows'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListContactFlowsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListContactFlowsResponseBody(name='body'),
}

async function listContactFlowsWithOptions(request: ListContactFlowsRequest, runtime: Util.RuntimeOptions): ListContactFlowsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListContactFlows',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listContactFlows(request: ListContactFlowsRequest): ListContactFlowsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listContactFlowsWithOptions(request, runtime);
}

model ListInstancesOfUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  instances?: {
    callCenterInstance?: [ 
    {
      admin?: {
        user?: [ 
        {
          detail?: {
            department?: string(name='Department'),
            displayName?: string(name='DisplayName'),
            email?: string(name='Email'),
            loginName?: string(name='LoginName'),
            phone?: string(name='Phone'),
          }(name='Detail'),
          instanceId?: string(name='InstanceId'),
          ramId?: string(name='RamId'),
          userId?: string(name='UserId'),
        }
      ](name='User')
      }(name='Admin'),
      consoleUrl?: string(name='ConsoleUrl'),
      createdTime?: long(name='CreatedTime'),
      directoryId?: string(name='DirectoryId'),
      domainName?: string(name='DomainName'),
      instanceDescription?: string(name='InstanceDescription'),
      instanceId?: string(name='InstanceId'),
      instanceName?: string(name='InstanceName'),
      maxOnlineAgents?: int32(name='MaxOnlineAgents'),
      owner?: string(name='Owner'),
      phoneNumbers?: {
        phoneNumber?: [ 
        {
          allowOutbound?: boolean(name='AllowOutbound'),
          instanceId?: string(name='InstanceId'),
          number?: string(name='Number'),
          phoneNumberDescription?: string(name='PhoneNumberDescription'),
          phoneNumberId?: string(name='PhoneNumberId'),
          remainingTime?: int32(name='RemainingTime'),
          testOnly?: boolean(name='TestOnly'),
          trunks?: int32(name='Trunks'),
          usage?: string(name='Usage'),
        }
      ](name='PhoneNumber')
      }(name='PhoneNumbers'),
      status?: string(name='Status'),
      storageBucket?: string(name='StorageBucket'),
      storageMaxDays?: int32(name='StorageMaxDays'),
      storageMaxSize?: int32(name='StorageMaxSize'),
      tenantId?: string(name='TenantId'),
    }
  ](name='CallCenterInstance')
  }(name='Instances'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListInstancesOfUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListInstancesOfUserResponseBody(name='body'),
}

async function listInstancesOfUserWithOptions(runtime: Util.RuntimeOptions): ListInstancesOfUserResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'ListInstancesOfUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listInstancesOfUser(): ListInstancesOfUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstancesOfUserWithOptions(runtime);
}

model ListIvrTrackingDetailRequest {
  calledNumber?: string(name='CalledNumber'),
  callingNumber?: string(name='CallingNumber'),
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
}

model ListIvrTrackingDetailResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  ivrTrackingDetails?: {
    list?: {
      ivrTrackingDetail?: [ 
      {
        calledNumber?: string(name='CalledNumber'),
        callingNumber?: string(name='CallingNumber'),
        contactId?: string(name='ContactId'),
        description?: string(name='Description'),
        deviceID?: string(name='DeviceID'),
        flowName?: string(name='FlowName'),
        inputData?: string(name='InputData'),
        nodeName?: string(name='NodeName'),
        nodeType?: string(name='NodeType'),
        outputData?: string(name='OutputData'),
        startTime?: long(name='StartTime'),
        status?: string(name='Status'),
        stopTime?: long(name='StopTime'),
        tenantId?: string(name='TenantId'),
      }
    ](name='IvrTrackingDetail')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='IvrTrackingDetails'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListIvrTrackingDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListIvrTrackingDetailResponseBody(name='body'),
}

async function listIvrTrackingDetailWithOptions(request: ListIvrTrackingDetailRequest, runtime: Util.RuntimeOptions): ListIvrTrackingDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.calledNumber)) {
    query['CalledNumber'] = request.calledNumber;
  }
  if (!Util.isUnset(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListIvrTrackingDetail',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listIvrTrackingDetail(request: ListIvrTrackingDetailRequest): ListIvrTrackingDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return listIvrTrackingDetailWithOptions(request, runtime);
}

model ListMediasRequest {
  instanceId?: string(name='InstanceId'),
  namePrefix?: string(name='NamePrefix'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListMediasResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  medias?: {
    list?: {
      media?: [ 
      {
        content?: string(name='Content'),
        description?: string(name='Description'),
        fileName?: string(name='FileName'),
        filePath?: string(name='FilePath'),
        instance?: string(name='Instance'),
        name?: string(name='Name'),
        ossFileName?: string(name='OssFileName'),
        status?: string(name='Status'),
        type?: string(name='Type'),
      }
    ](name='Media')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Medias'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListMediasResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMediasResponseBody(name='body'),
}

async function listMediasWithOptions(request: ListMediasRequest, runtime: Util.RuntimeOptions): ListMediasResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.namePrefix)) {
    query['NamePrefix'] = request.namePrefix;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMedias',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listMedias(request: ListMediasRequest): ListMediasResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMediasWithOptions(request, runtime);
}

model ListOutboundPhoneNumberOfUserRequest {
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  userId?: string(name='UserId'),
}

model ListOutboundPhoneNumberOfUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  numberList?: {
    number?: [ string ](name='Number')
  }(name='NumberList'),
  outboundPhoneNumbers?: {
    phoneNumber?: [ 
    {
      allowOutbound?: boolean(name='AllowOutbound'),
      city?: string(name='City'),
      instanceId?: string(name='InstanceId'),
      number?: string(name='Number'),
      phoneNumberDescription?: string(name='PhoneNumberDescription'),
      phoneNumberId?: string(name='PhoneNumberId'),
      privacyNumber?: {
        bizId?: string(name='BizId'),
        extra?: string(name='Extra'),
        phoneNumber?: string(name='PhoneNumber'),
        poolId?: string(name='PoolId'),
        poolName?: string(name='PoolName'),
        regionNameCity?: string(name='RegionNameCity'),
        subId?: string(name='SubId'),
        telX?: string(name='TelX'),
        type?: string(name='Type'),
      }(name='PrivacyNumber'),
      privateFlag?: boolean(name='PrivateFlag'),
      province?: string(name='Province'),
      remainingTime?: int32(name='RemainingTime'),
      sipTelX?: string(name='SipTelX'),
      testOnly?: boolean(name='TestOnly'),
      trunks?: int32(name='Trunks'),
      usage?: string(name='Usage'),
    }
  ](name='PhoneNumber')
  }(name='OutboundPhoneNumbers'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListOutboundPhoneNumberOfUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListOutboundPhoneNumberOfUserResponseBody(name='body'),
}

async function listOutboundPhoneNumberOfUserWithOptions(request: ListOutboundPhoneNumberOfUserRequest, runtime: Util.RuntimeOptions): ListOutboundPhoneNumberOfUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListOutboundPhoneNumberOfUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listOutboundPhoneNumberOfUser(request: ListOutboundPhoneNumberOfUserRequest): ListOutboundPhoneNumberOfUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return listOutboundPhoneNumberOfUserWithOptions(request, runtime);
}

model ListPhoneNumbersRequest {
  instanceId?: string(name='InstanceId'),
  outboundOnly?: boolean(name='OutboundOnly'),
}

model ListPhoneNumbersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  phoneNumbers?: {
    phoneNumber?: [ 
    {
      allowOutbound?: boolean(name='AllowOutbound'),
      assignee?: string(name='Assignee'),
      city?: string(name='City'),
      contactFlow?: {
        contactFlowDescription?: string(name='ContactFlowDescription'),
        contactFlowId?: string(name='ContactFlowId'),
        contactFlowName?: string(name='ContactFlowName'),
        instanceId?: string(name='InstanceId'),
        type?: string(name='Type'),
      }(name='ContactFlow'),
      instanceId?: string(name='InstanceId'),
      number?: string(name='Number'),
      numberCommodityStatus?: int32(name='NumberCommodityStatus'),
      phoneNumberDescription?: string(name='PhoneNumberDescription'),
      phoneNumberId?: string(name='PhoneNumberId'),
      privacyNumber?: {
        bizId?: string(name='BizId'),
        extra?: string(name='Extra'),
        phoneNumber?: string(name='PhoneNumber'),
        poolId?: string(name='PoolId'),
        poolName?: string(name='PoolName'),
        regionNameCity?: string(name='RegionNameCity'),
        subId?: string(name='SubId'),
        telX?: string(name='TelX'),
        type?: string(name='Type'),
      }(name='PrivacyNumber'),
      province?: string(name='Province'),
      remainingTime?: int32(name='RemainingTime'),
      sipTelX?: string(name='SipTelX'),
      skillGroups?: {
        skillGroup?: [ 
        {
          skillGroupId?: string(name='SkillGroupId'),
          skillGroupName?: string(name='SkillGroupName'),
        }
      ](name='SkillGroup')
      }(name='SkillGroups'),
      testOnly?: boolean(name='TestOnly'),
      trunks?: int32(name='Trunks'),
      usage?: string(name='Usage'),
    }
  ](name='PhoneNumber')
  }(name='PhoneNumbers'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListPhoneNumbersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPhoneNumbersResponseBody(name='body'),
}

async function listPhoneNumbersWithOptions(request: ListPhoneNumbersRequest, runtime: Util.RuntimeOptions): ListPhoneNumbersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.outboundOnly)) {
    query['OutboundOnly'] = request.outboundOnly;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPhoneNumbers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPhoneNumbers(request: ListPhoneNumbersRequest): ListPhoneNumbersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPhoneNumbersWithOptions(request, runtime);
}

model ListPhoneTagsRequest {
  currentPage?: int32(name='CurrentPage'),
  instanceId?: string(name='InstanceId'),
  number?: string(name='Number'),
  numberGroupIds?: [ string ](name='NumberGroupIds'),
  outboundOnly?: boolean(name='OutboundOnly'),
  pageSize?: int32(name='PageSize'),
}

model ListPhoneTagsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  phoneNumbers?: {
    list?: [ 
      {
        city?: string(name='City'),
        concurrency?: int32(name='Concurrency'),
        contactFlowId?: string(name='ContactFlowId'),
        createTime?: long(name='CreateTime'),
        instanceId?: string(name='InstanceId'),
        number?: string(name='Number'),
        phoneNumberDescription?: string(name='PhoneNumberDescription'),
        phoneNumberId?: string(name='PhoneNumberId'),
        provider?: string(name='Provider'),
        province?: string(name='Province'),
        serviceTag?: string(name='ServiceTag'),
        skillGroupIdList?: [ string ](name='SkillGroupIdList'),
        type?: int32(name='Type'),
        usage?: string(name='Usage'),
      }
    ](name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PhoneNumbers'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListPhoneTagsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPhoneTagsResponseBody(name='body'),
}

async function listPhoneTagsWithOptions(request: ListPhoneTagsRequest, runtime: Util.RuntimeOptions): ListPhoneTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.number)) {
    query['Number'] = request.number;
  }
  if (!Util.isUnset(request.numberGroupIds)) {
    query['NumberGroupIds'] = request.numberGroupIds;
  }
  if (!Util.isUnset(request.outboundOnly)) {
    query['OutboundOnly'] = request.outboundOnly;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPhoneTags',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPhoneTags(request: ListPhoneTagsRequest): ListPhoneTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPhoneTagsWithOptions(request, runtime);
}

model ListRealTimeAgentRequest {
  instanceId?: string(name='InstanceId'),
}

model ListRealTimeAgentResponseBody = {
  code?: string(name='Code'),
  data?: {
    user?: [ 
    {
      displayName?: string(name='DisplayName'),
      dn?: string(name='Dn'),
      phone?: string(name='Phone'),
      ramId?: string(name='RamId'),
      skillLevels?: {
        skillLevel?: [ 
        {
          level?: int32(name='Level'),
          skill?: {
            instanceId?: string(name='InstanceId'),
            skillGroupDescription?: string(name='SkillGroupDescription'),
            skillGroupId?: string(name='SkillGroupId'),
            skillGroupName?: string(name='SkillGroupName'),
          }(name='Skill'),
          skillLevelId?: string(name='SkillLevelId'),
        }
      ](name='SkillLevel')
      }(name='SkillLevels'),
      state?: string(name='State'),
      stateDesc?: string(name='StateDesc'),
    }
  ](name='User')
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListRealTimeAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRealTimeAgentResponseBody(name='body'),
}

async function listRealTimeAgentWithOptions(request: ListRealTimeAgentRequest, runtime: Util.RuntimeOptions): ListRealTimeAgentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRealTimeAgent',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRealTimeAgent(request: ListRealTimeAgentRequest): ListRealTimeAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRealTimeAgentWithOptions(request, runtime);
}

model ListRecentCallRecordsRequest {
  criteria?: string(name='Criteria'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
}

model ListRecentCallRecordsResponseBody = {
  callDetailRecords?: {
    list?: {
      callDetailRecord?: [ 
      {
        agentNames?: string(name='AgentNames'),
        agents?: {
          callDetailAgent?: [ 
          {
            agentId?: string(name='AgentId'),
            agentName?: string(name='AgentName'),
            contactId?: string(name='ContactId'),
            feedback?: string(name='Feedback'),
            holdTime?: int32(name='HoldTime'),
            queueTime?: int32(name='QueueTime'),
            ringTime?: int32(name='RingTime'),
            satisfaction?: string(name='Satisfaction'),
            skillGroupName?: string(name='SkillGroupName'),
            startTime?: long(name='StartTime'),
            talkTime?: int32(name='TalkTime'),
            workTime?: int32(name='WorkTime'),
          }
        ](name='CallDetailAgent')
        }(name='Agents'),
        calledNumber?: string(name='CalledNumber'),
        callingNumber?: string(name='CallingNumber'),
        contactDisposition?: string(name='ContactDisposition'),
        contactId?: string(name='ContactId'),
        contactType?: string(name='ContactType'),
        duration?: int32(name='Duration'),
        extraAttr?: string(name='ExtraAttr'),
        feedback?: string(name='Feedback'),
        instanceId?: string(name='InstanceId'),
        recordings?: {
          recording?: [ 
          {
            agentId?: string(name='AgentId'),
            agentName?: string(name='AgentName'),
            calledNumber?: string(name='CalledNumber'),
            callingNumber?: string(name='CallingNumber'),
            channel?: string(name='Channel'),
            contactId?: string(name='ContactId'),
            contactType?: string(name='ContactType'),
            duration?: int32(name='Duration'),
            fileDescription?: string(name='FileDescription'),
            fileName?: string(name='FileName'),
            filePath?: string(name='FilePath'),
            instanceId?: string(name='InstanceId'),
            startTime?: long(name='StartTime'),
          }
        ](name='Recording')
        }(name='Recordings'),
        satisfaction?: int32(name='Satisfaction'),
        satisfactionDesc?: string(name='SatisfactionDesc'),
        skillGroupNames?: string(name='SkillGroupNames'),
        startTime?: long(name='StartTime'),
      }
    ](name='CallDetailRecord')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='CallDetailRecords'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListRecentCallRecordsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRecentCallRecordsResponseBody(name='body'),
}

async function listRecentCallRecordsWithOptions(request: ListRecentCallRecordsRequest, runtime: Util.RuntimeOptions): ListRecentCallRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.criteria)) {
    query['Criteria'] = request.criteria;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRecentCallRecords',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRecentCallRecords(request: ListRecentCallRecordsRequest): ListRecentCallRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRecentCallRecordsWithOptions(request, runtime);
}

model ListRecordingOfDualTrackRequest {
  agentId?: string(name='AgentId'),
  calledNumber?: string(name='CalledNumber'),
  callingNumber?: string(name='CallingNumber'),
  connectId?: string(name='ConnectId'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
}

model ListRecordingOfDualTrackResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  recordings?: {
    list?: {
      recording?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        calledNumber?: string(name='CalledNumber'),
        callingNumber?: string(name='CallingNumber'),
        channel?: string(name='Channel'),
        contactId?: string(name='ContactId'),
        contactType?: string(name='ContactType'),
        duration?: int32(name='Duration'),
        fileDescription?: string(name='FileDescription'),
        fileName?: string(name='FileName'),
        filePath?: string(name='FilePath'),
        instanceId?: string(name='InstanceId'),
        startTime?: long(name='StartTime'),
      }
    ](name='Recording')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Recordings'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListRecordingOfDualTrackResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRecordingOfDualTrackResponseBody(name='body'),
}

async function listRecordingOfDualTrackWithOptions(request: ListRecordingOfDualTrackRequest, runtime: Util.RuntimeOptions): ListRecordingOfDualTrackResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentId)) {
    query['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.calledNumber)) {
    query['CalledNumber'] = request.calledNumber;
  }
  if (!Util.isUnset(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!Util.isUnset(request.connectId)) {
    query['ConnectId'] = request.connectId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRecordingOfDualTrack',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRecordingOfDualTrack(request: ListRecordingOfDualTrackRequest): ListRecordingOfDualTrackResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRecordingOfDualTrackWithOptions(request, runtime);
}

model ListRecordingsRequest {
  agentId?: string(name='AgentId'),
  criteria?: string(name='Criteria'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  phoneNumber?: string(name='PhoneNumber'),
  startTime?: long(name='StartTime'),
  stopTime?: long(name='StopTime'),
}

model ListRecordingsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  recordings?: {
    list?: {
      recording?: [ 
      {
        agentId?: string(name='AgentId'),
        agentName?: string(name='AgentName'),
        calledNumber?: string(name='CalledNumber'),
        callingNumber?: string(name='CallingNumber'),
        channel?: string(name='Channel'),
        contactId?: string(name='ContactId'),
        contactType?: string(name='ContactType'),
        duration?: int32(name='Duration'),
        fileDescription?: string(name='FileDescription'),
        fileName?: string(name='FileName'),
        filePath?: string(name='FilePath'),
        instanceId?: string(name='InstanceId'),
        startTime?: long(name='StartTime'),
      }
    ](name='Recording')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Recordings'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListRecordingsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRecordingsResponseBody(name='body'),
}

async function listRecordingsWithOptions(request: ListRecordingsRequest, runtime: Util.RuntimeOptions): ListRecordingsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentId)) {
    query['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.criteria)) {
    query['Criteria'] = request.criteria;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.stopTime)) {
    query['StopTime'] = request.stopTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRecordings',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRecordings(request: ListRecordingsRequest): ListRecordingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRecordingsWithOptions(request, runtime);
}

model ListRecordingsByContactIdRequest {
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
}

model ListRecordingsByContactIdResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  recordings?: {
    recording?: [ 
    {
      agentId?: string(name='AgentId'),
      agentName?: string(name='AgentName'),
      calledNumber?: string(name='CalledNumber'),
      callingNumber?: string(name='CallingNumber'),
      channel?: string(name='Channel'),
      contactId?: string(name='ContactId'),
      contactType?: string(name='ContactType'),
      duration?: int32(name='Duration'),
      fileDescription?: string(name='FileDescription'),
      fileName?: string(name='FileName'),
      filePath?: string(name='FilePath'),
      instanceId?: string(name='InstanceId'),
      qualityCheckTaskId?: string(name='QualityCheckTaskId'),
      qualityCheckTid?: string(name='QualityCheckTid'),
      startTime?: long(name='StartTime'),
    }
  ](name='Recording')
  }(name='Recordings'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListRecordingsByContactIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRecordingsByContactIdResponseBody(name='body'),
}

async function listRecordingsByContactIdWithOptions(request: ListRecordingsByContactIdRequest, runtime: Util.RuntimeOptions): ListRecordingsByContactIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRecordingsByContactId',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRecordingsByContactId(request: ListRecordingsByContactIdRequest): ListRecordingsByContactIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRecordingsByContactIdWithOptions(request, runtime);
}

model ListRolesRequest {
  instanceId?: string(name='InstanceId'),
}

model ListRolesResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  roles?: {
    role?: [ 
    {
      instanceId?: string(name='InstanceId'),
      roleDescription?: string(name='RoleDescription'),
      roleId?: string(name='RoleId'),
      roleName?: string(name='RoleName'),
    }
  ](name='Role')
  }(name='Roles'),
  success?: boolean(name='Success'),
}

model ListRolesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRolesResponseBody(name='body'),
}

async function listRolesWithOptions(request: ListRolesRequest, runtime: Util.RuntimeOptions): ListRolesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRoles',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRoles(request: ListRolesRequest): ListRolesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRolesWithOptions(request, runtime);
}

model ListSkillGroupStatesRequest {
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupIds?: string(name='SkillGroupIds'),
}

model ListSkillGroupStatesResponseBody = {
  code?: string(name='Code'),
  data?: {
    list?: {
      realTimeSkillGroupState?: [ 
      {
        breakingAgents?: long(name='BreakingAgents'),
        instanceId?: string(name='InstanceId'),
        loggedInAgents?: long(name='LoggedInAgents'),
        longestCall?: long(name='LongestCall'),
        readyAgents?: long(name='ReadyAgents'),
        skillGroupId?: string(name='SkillGroupId'),
        skillGroupName?: string(name='SkillGroupName'),
        talkingAgents?: long(name='TalkingAgents'),
        waitingCalls?: long(name='WaitingCalls'),
        workingAgents?: long(name='WorkingAgents'),
      }
    ](name='RealTimeSkillGroupState')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListSkillGroupStatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupStatesResponseBody(name='body'),
}

async function listSkillGroupStatesWithOptions(request: ListSkillGroupStatesRequest, runtime: Util.RuntimeOptions): ListSkillGroupStatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupIds)) {
    query['SkillGroupIds'] = request.skillGroupIds;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroupStates',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroupStates(request: ListSkillGroupStatesRequest): ListSkillGroupStatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupStatesWithOptions(request, runtime);
}

model ListSkillGroupSummaryReportsRequest {
  endTime?: string(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupIds?: string(name='SkillGroupIds'),
  startTime?: string(name='StartTime'),
}

model ListSkillGroupSummaryReportsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pagedSkillGroupSummaryReport?: {
    list?: {
      skillGroupSummaryReport?: [ 
      {
        inbound?: {
          abandonedInQueueOfQueueCount?: long(name='AbandonedInQueueOfQueueCount'),
          answeredByAgentOfQueueCount?: long(name='AnsweredByAgentOfQueueCount'),
          answeredByAgentOfQueueMaxWaitTimeDuration?: long(name='AnsweredByAgentOfQueueMaxWaitTimeDuration'),
          answeredByAgentOfQueueWaitTimeDuration?: long(name='AnsweredByAgentOfQueueWaitTimeDuration'),
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsHandled?: long(name='CallsHandled'),
          callsOffered?: long(name='CallsOffered'),
          giveUpByAgentOfQueueCount?: long(name='GiveUpByAgentOfQueueCount'),
          handleRate?: float(name='HandleRate'),
          inComingQueueOfQueueCount?: long(name='InComingQueueOfQueueCount'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: string(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          overFlowInQueueOfQueueCount?: long(name='OverFlowInQueueOfQueueCount'),
          queueMaxWaitTimeDuration?: long(name='QueueMaxWaitTimeDuration'),
          queueWaitTimeDuration?: long(name='QueueWaitTimeDuration'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          serviceLevel20?: float(name='ServiceLevel20'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageReadyTime?: long(name='AverageReadyTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          maxReadyTime?: long(name='MaxReadyTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          occupancyRate?: float(name='OccupancyRate'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalBreakTime?: long(name='TotalBreakTime'),
          totalCalls?: long(name='TotalCalls'),
          totalLoggedInTime?: long(name='TotalLoggedInTime'),
          totalReadyTime?: long(name='TotalReadyTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        skillGroupId?: string(name='SkillGroupId'),
        skillGroupName?: string(name='SkillGroupName'),
      }
    ](name='SkillGroupSummaryReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PagedSkillGroupSummaryReport'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListSkillGroupSummaryReportsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupSummaryReportsResponseBody(name='body'),
}

async function listSkillGroupSummaryReportsWithOptions(request: ListSkillGroupSummaryReportsRequest, runtime: Util.RuntimeOptions): ListSkillGroupSummaryReportsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupIds)) {
    query['SkillGroupIds'] = request.skillGroupIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroupSummaryReports',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroupSummaryReports(request: ListSkillGroupSummaryReportsRequest): ListSkillGroupSummaryReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupSummaryReportsWithOptions(request, runtime);
}

model ListSkillGroupSummaryReportsByIntervalRequest {
  endTime?: string(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  interval?: string(name='Interval'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupIds?: string(name='SkillGroupIds'),
  startTime?: string(name='StartTime'),
}

model ListSkillGroupSummaryReportsByIntervalResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pagedSkillGroupSummaryReport?: {
    list?: {
      skillGroupTimeIntervalReport?: [ 
      {
        intervalList?: {
          skillGroupSummaryReport?: [ 
          {
            inbound?: {
              abandonedInQueueOfQueueCount?: long(name='AbandonedInQueueOfQueueCount'),
              answeredByAgentOfQueueCount?: long(name='AnsweredByAgentOfQueueCount'),
              answeredByAgentOfQueueMaxWaitTimeDuration?: long(name='AnsweredByAgentOfQueueMaxWaitTimeDuration'),
              answeredByAgentOfQueueWaitTimeDuration?: long(name='AnsweredByAgentOfQueueWaitTimeDuration'),
              averageRingTime?: long(name='AverageRingTime'),
              averageTalkTime?: long(name='AverageTalkTime'),
              averageWorkTime?: long(name='AverageWorkTime'),
              callsHandled?: long(name='CallsHandled'),
              callsOffered?: long(name='CallsOffered'),
              giveUpByAgentOfQueueCount?: long(name='GiveUpByAgentOfQueueCount'),
              handleRate?: float(name='HandleRate'),
              inComingQueueOfQueueCount?: long(name='InComingQueueOfQueueCount'),
              maxRingTime?: long(name='MaxRingTime'),
              maxTalkTime?: long(name='MaxTalkTime'),
              maxWorkTime?: long(name='MaxWorkTime'),
              overFlowInQueueOfQueueCount?: long(name='OverFlowInQueueOfQueueCount'),
              queueMaxWaitTimeDuration?: long(name='QueueMaxWaitTimeDuration'),
              queueWaitTimeDuration?: long(name='QueueWaitTimeDuration'),
              satisfactionIndex?: float(name='SatisfactionIndex'),
              satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
              satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
              serviceLevel20?: float(name='ServiceLevel20'),
              totalRingTime?: long(name='TotalRingTime'),
              totalTalkTime?: long(name='TotalTalkTime'),
              totalWorkTime?: long(name='TotalWorkTime'),
            }(name='Inbound'),
            instanceId?: string(name='InstanceId'),
            outbound?: {
              answerRate?: float(name='AnswerRate'),
              averageDialingTime?: long(name='AverageDialingTime'),
              averageTalkTime?: long(name='AverageTalkTime'),
              averageWorkTime?: long(name='AverageWorkTime'),
              callsAnswered?: long(name='CallsAnswered'),
              callsDialed?: long(name='CallsDialed'),
              maxDialingTime?: long(name='MaxDialingTime'),
              maxTalkTime?: long(name='MaxTalkTime'),
              maxWorkTime?: long(name='MaxWorkTime'),
              satisfactionIndex?: float(name='SatisfactionIndex'),
              satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
              satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
              totalDialingTime?: long(name='TotalDialingTime'),
              totalTalkTime?: long(name='TotalTalkTime'),
              totalWorkTime?: long(name='TotalWorkTime'),
            }(name='Outbound'),
            overall?: {
              averageReadyTime?: long(name='AverageReadyTime'),
              averageTalkTime?: long(name='AverageTalkTime'),
              averageWorkTime?: long(name='AverageWorkTime'),
              maxReadyTime?: long(name='MaxReadyTime'),
              maxTalkTime?: long(name='MaxTalkTime'),
              maxWorkTime?: long(name='MaxWorkTime'),
              occupancyRate?: float(name='OccupancyRate'),
              satisfactionIndex?: float(name='SatisfactionIndex'),
              satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
              satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
              totalBreakTime?: long(name='TotalBreakTime'),
              totalCalls?: long(name='TotalCalls'),
              totalLoggedInTime?: long(name='TotalLoggedInTime'),
              totalReadyTime?: long(name='TotalReadyTime'),
              totalTalkTime?: long(name='TotalTalkTime'),
              totalWorkTime?: long(name='TotalWorkTime'),
            }(name='Overall'),
            skillGroupId?: string(name='SkillGroupId'),
            skillGroupName?: string(name='SkillGroupName'),
            timestamp?: string(name='Timestamp'),
          }
        ](name='SkillGroupSummaryReport')
        }(name='IntervalList'),
        skillGroupId?: string(name='SkillGroupId'),
      }
    ](name='SkillGroupTimeIntervalReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PagedSkillGroupSummaryReport'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListSkillGroupSummaryReportsByIntervalResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupSummaryReportsByIntervalResponseBody(name='body'),
}

async function listSkillGroupSummaryReportsByIntervalWithOptions(request: ListSkillGroupSummaryReportsByIntervalRequest, runtime: Util.RuntimeOptions): ListSkillGroupSummaryReportsByIntervalResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupIds)) {
    query['SkillGroupIds'] = request.skillGroupIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroupSummaryReportsByInterval',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroupSummaryReportsByInterval(request: ListSkillGroupSummaryReportsByIntervalRequest): ListSkillGroupSummaryReportsByIntervalResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupSummaryReportsByIntervalWithOptions(request, runtime);
}

model ListSkillGroupSummaryReportsSinceMidnightRequest {
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroups?: string(name='SkillGroups'),
}

model ListSkillGroupSummaryReportsSinceMidnightResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  pagedSkillGroupSummaryReport?: {
    list?: {
      skillGroupSummaryReport?: [ 
      {
        inbound?: {
          abandonedInQueueOfQueueCount?: long(name='AbandonedInQueueOfQueueCount'),
          answeredByAgentOfQueueCount?: long(name='AnsweredByAgentOfQueueCount'),
          answeredByAgentOfQueueMaxWaitTimeDuration?: long(name='AnsweredByAgentOfQueueMaxWaitTimeDuration'),
          answeredByAgentOfQueueWaitTimeDuration?: long(name='AnsweredByAgentOfQueueWaitTimeDuration'),
          averageRingTime?: long(name='AverageRingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsHandled?: long(name='CallsHandled'),
          callsOffered?: long(name='CallsOffered'),
          callsServiceLevel20?: long(name='CallsServiceLevel20'),
          callsServiceLevel30?: long(name='CallsServiceLevel30'),
          giveUpByAgentOfQueueCount?: long(name='GiveUpByAgentOfQueueCount'),
          handleRate?: float(name='HandleRate'),
          inComingQueueOfQueueCount?: long(name='InComingQueueOfQueueCount'),
          maxRingTime?: long(name='MaxRingTime'),
          maxTalkTime?: string(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          overFlowInQueueOfQueueCount?: long(name='OverFlowInQueueOfQueueCount'),
          queueMaxWaitTimeDuration?: long(name='QueueMaxWaitTimeDuration'),
          queueWaitTimeDuration?: long(name='QueueWaitTimeDuration'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          serviceLevel20?: float(name='ServiceLevel20'),
          totalRingTime?: long(name='TotalRingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Inbound'),
        instanceId?: string(name='InstanceId'),
        outbound?: {
          answerRate?: float(name='AnswerRate'),
          averageDialingTime?: long(name='AverageDialingTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          callsAnswered?: long(name='CallsAnswered'),
          callsDialed?: long(name='CallsDialed'),
          maxDialingTime?: long(name='MaxDialingTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalDialingTime?: long(name='TotalDialingTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Outbound'),
        overall?: {
          averageReadyTime?: long(name='AverageReadyTime'),
          averageTalkTime?: long(name='AverageTalkTime'),
          averageWorkTime?: long(name='AverageWorkTime'),
          maxReadyTime?: long(name='MaxReadyTime'),
          maxTalkTime?: long(name='MaxTalkTime'),
          maxWorkTime?: long(name='MaxWorkTime'),
          occupancyRate?: float(name='OccupancyRate'),
          satisfactionIndex?: float(name='SatisfactionIndex'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded'),
          totalBreakTime?: long(name='TotalBreakTime'),
          totalCalls?: long(name='TotalCalls'),
          totalLoggedInTime?: long(name='TotalLoggedInTime'),
          totalReadyTime?: long(name='TotalReadyTime'),
          totalTalkTime?: long(name='TotalTalkTime'),
          totalWorkTime?: long(name='TotalWorkTime'),
        }(name='Overall'),
        skillGroupId?: string(name='SkillGroupId'),
        skillGroupName?: string(name='SkillGroupName'),
        timestamp?: string(name='Timestamp'),
      }
    ](name='SkillGroupSummaryReport')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='PagedSkillGroupSummaryReport'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListSkillGroupSummaryReportsSinceMidnightResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupSummaryReportsSinceMidnightResponseBody(name='body'),
}

async function listSkillGroupSummaryReportsSinceMidnightWithOptions(request: ListSkillGroupSummaryReportsSinceMidnightRequest, runtime: Util.RuntimeOptions): ListSkillGroupSummaryReportsSinceMidnightResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroups)) {
    query['SkillGroups'] = request.skillGroups;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroupSummaryReportsSinceMidnight',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroupSummaryReportsSinceMidnight(request: ListSkillGroupSummaryReportsSinceMidnightRequest): ListSkillGroupSummaryReportsSinceMidnightResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupSummaryReportsSinceMidnightWithOptions(request, runtime);
}

model ListSkillGroupsRequest {
  instanceId?: string(name='InstanceId'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  skillGroupName?: [ string ](name='SkillGroupName'),
}

model ListSkillGroupsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  skillGroups?: {
    skillGroup?: [ 
    {
      accQueueName?: string(name='AccQueueName'),
      accSkillGroupName?: string(name='AccSkillGroupName'),
      instanceId?: string(name='InstanceId'),
      outboundPhoneNumbers?: {
        phoneNumber?: [ 
        {
          allowOutbound?: boolean(name='AllowOutbound'),
          instanceId?: string(name='InstanceId'),
          number?: string(name='Number'),
          phoneNumberDescription?: string(name='PhoneNumberDescription'),
          phoneNumberId?: string(name='PhoneNumberId'),
          remainingTime?: int32(name='RemainingTime'),
          testOnly?: boolean(name='TestOnly'),
          trunks?: int32(name='Trunks'),
          usage?: string(name='Usage'),
        }
      ](name='PhoneNumber')
      }(name='OutboundPhoneNumbers'),
      routingStrategy?: string(name='RoutingStrategy'),
      skillGroupDescription?: string(name='SkillGroupDescription'),
      skillGroupId?: string(name='SkillGroupId'),
      skillGroupName?: string(name='SkillGroupName'),
      userCount?: int32(name='UserCount'),
    }
  ](name='SkillGroup')
  }(name='SkillGroups'),
  success?: boolean(name='Success'),
}

model ListSkillGroupsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupsResponseBody(name='body'),
}

async function listSkillGroupsWithOptions(request: ListSkillGroupsRequest, runtime: Util.RuntimeOptions): ListSkillGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillGroupName)) {
    query['SkillGroupName'] = request.skillGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroups',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroups(request: ListSkillGroupsRequest): ListSkillGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupsWithOptions(request, runtime);
}

model ListSkillGroupsOfUserRequest {
  instanceId?: string(name='InstanceId'),
  userId?: string(name='UserId'),
}

model ListSkillGroupsOfUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  skillLevels?: {
    skillLevel?: [ 
    {
      level?: int32(name='Level'),
      skill?: {
        instanceId?: string(name='InstanceId'),
        outboundPhoneNumbers?: {
          phoneNumber?: [ 
          {
            allowOutbound?: boolean(name='AllowOutbound'),
            city?: string(name='City'),
            instanceId?: string(name='InstanceId'),
            number?: string(name='Number'),
            phoneNumberDescription?: string(name='PhoneNumberDescription'),
            phoneNumberId?: string(name='PhoneNumberId'),
            province?: string(name='Province'),
            remainingTime?: int32(name='RemainingTime'),
            testOnly?: boolean(name='TestOnly'),
            trunks?: int32(name='Trunks'),
            usage?: string(name='Usage'),
          }
        ](name='PhoneNumber')
        }(name='OutboundPhoneNumbers'),
        routingStrategy?: string(name='RoutingStrategy'),
        skillGroupDescription?: string(name='SkillGroupDescription'),
        skillGroupId?: string(name='SkillGroupId'),
        skillGroupName?: string(name='SkillGroupName'),
      }(name='Skill'),
      skillLevelId?: string(name='SkillLevelId'),
    }
  ](name='SkillLevel')
  }(name='SkillLevels'),
  success?: boolean(name='Success'),
}

model ListSkillGroupsOfUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupsOfUserResponseBody(name='body'),
}

async function listSkillGroupsOfUserWithOptions(request: ListSkillGroupsOfUserRequest, runtime: Util.RuntimeOptions): ListSkillGroupsOfUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroupsOfUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroupsOfUser(request: ListSkillGroupsOfUserRequest): ListSkillGroupsOfUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupsOfUserWithOptions(request, runtime);
}

model ListTransferableSkillGroupsRequest {
  instanceId?: string(name='InstanceId'),
}

model ListTransferableSkillGroupsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  skillGroups?: [ 
    {
      accQueueName?: string(name='AccQueueName'),
      accSkillGroupName?: string(name='AccSkillGroupName'),
      allowPrivateOutboundNumber?: boolean(name='AllowPrivateOutboundNumber'),
      instanceId?: string(name='InstanceId'),
      routingStrategy?: string(name='RoutingStrategy'),
      skillGroupDescription?: string(name='SkillGroupDescription'),
      skillGroupId?: string(name='SkillGroupId'),
      skillGroupName?: string(name='SkillGroupName'),
      userCount?: int32(name='UserCount'),
    }
  ](name='SkillGroups'),
  success?: boolean(name='Success'),
}

model ListTransferableSkillGroupsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTransferableSkillGroupsResponseBody(name='body'),
}

async function listTransferableSkillGroupsWithOptions(request: ListTransferableSkillGroupsRequest, runtime: Util.RuntimeOptions): ListTransferableSkillGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTransferableSkillGroups',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTransferableSkillGroups(request: ListTransferableSkillGroupsRequest): ListTransferableSkillGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTransferableSkillGroupsWithOptions(request, runtime);
}

model ListTrunkProvidersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  trunkProviders?: [ 
    {
      providerName?: string(name='ProviderName'),
      status?: string(name='Status'),
    }
  ](name='TrunkProviders'),
}

model ListTrunkProvidersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTrunkProvidersResponseBody(name='body'),
}

async function listTrunkProvidersWithOptions(runtime: Util.RuntimeOptions): ListTrunkProvidersResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'ListTrunkProviders',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTrunkProviders(): ListTrunkProvidersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTrunkProvidersWithOptions(runtime);
}

model ListTrunksOfSkillGroupRequest {
  instanceId?: string(name='InstanceId'),
  skillGroupId?: string(name='SkillGroupId'),
}

model ListTrunksOfSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  trunkConfigs?: [ 
    {
      primary?: boolean(name='Primary'),
      providerName?: string(name='ProviderName'),
    }
  ](name='TrunkConfigs'),
}

model ListTrunksOfSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTrunksOfSkillGroupResponseBody(name='body'),
}

async function listTrunksOfSkillGroupWithOptions(request: ListTrunksOfSkillGroupRequest, runtime: Util.RuntimeOptions): ListTrunksOfSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrunksOfSkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTrunksOfSkillGroup(request: ListTrunksOfSkillGroupRequest): ListTrunksOfSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTrunksOfSkillGroupWithOptions(request, runtime);
}

model ListUsersRequest {
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListUsersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  users?: {
    list?: {
      user?: [ 
      {
        detail?: {
          department?: string(name='Department'),
          displayName?: string(name='DisplayName'),
          email?: string(name='Email'),
          loginName?: string(name='LoginName'),
          phone?: string(name='Phone'),
        }(name='Detail'),
        instanceId?: string(name='InstanceId'),
        primary?: boolean(name='Primary'),
        privateOutboundNumberId?: string(name='PrivateOutboundNumberId'),
        ramId?: string(name='RamId'),
        roles?: {
          role?: [ 
          {
            instanceId?: string(name='InstanceId'),
            roleDescription?: string(name='RoleDescription'),
            roleId?: string(name='RoleId'),
            roleName?: string(name='RoleName'),
          }
        ](name='Role')
        }(name='Roles'),
        skillLevels?: {
          skillLevel?: [ 
          {
            level?: int32(name='Level'),
            skill?: {
              instanceId?: string(name='InstanceId'),
              skillGroupDescription?: string(name='SkillGroupDescription'),
              skillGroupId?: string(name='SkillGroupId'),
              skillGroupName?: string(name='SkillGroupName'),
            }(name='Skill'),
            skillLevelId?: string(name='SkillLevelId'),
          }
        ](name='SkillLevel')
        }(name='SkillLevels'),
        userId?: string(name='UserId'),
      }
    ](name='User')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Users'),
}

model ListUsersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListUsersResponseBody(name='body'),
}

async function listUsersWithOptions(request: ListUsersRequest, runtime: Util.RuntimeOptions): ListUsersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListUsers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listUsers(request: ListUsersRequest): ListUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listUsersWithOptions(request, runtime);
}

model ListUsersOfSkillGroupRequest {
  instanceId?: string(name='InstanceId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  skillGroupId?: string(name='SkillGroupId'),
}

model ListUsersOfSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  users?: {
    list?: {
      user?: [ 
      {
        detail?: {
          department?: string(name='Department'),
          displayName?: string(name='DisplayName'),
          email?: string(name='Email'),
          loginName?: string(name='LoginName'),
          phone?: string(name='Phone'),
        }(name='Detail'),
        instanceId?: string(name='InstanceId'),
        ramId?: string(name='RamId'),
        roles?: {
          role?: [ 
          {
            instanceId?: string(name='InstanceId'),
            privileges?: {
              privilege?: [ 
              {
                privilegeDescription?: string(name='PrivilegeDescription'),
                privilegeId?: string(name='PrivilegeId'),
                privilegeName?: string(name='PrivilegeName'),
              }
            ](name='Privilege')
            }(name='Privileges'),
            roleDescription?: string(name='RoleDescription'),
            roleId?: string(name='RoleId'),
            roleName?: string(name='RoleName'),
            userCount?: int32(name='UserCount'),
          }
        ](name='Role')
        }(name='Roles'),
        skillLevels?: {
          skillLevel?: [ 
          {
            level?: int32(name='Level'),
            skill?: {
              instanceId?: string(name='InstanceId'),
              skillGroupDescription?: string(name='SkillGroupDescription'),
              skillGroupId?: string(name='SkillGroupId'),
              skillGroupName?: string(name='SkillGroupName'),
            }(name='Skill'),
            skillLevelId?: string(name='SkillLevelId'),
          }
        ](name='SkillLevel')
        }(name='SkillLevels'),
        userId?: string(name='UserId'),
      }
    ](name='User')
    }(name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Users'),
}

model ListUsersOfSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListUsersOfSkillGroupResponseBody(name='body'),
}

async function listUsersOfSkillGroupWithOptions(request: ListUsersOfSkillGroupRequest, runtime: Util.RuntimeOptions): ListUsersOfSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListUsersOfSkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listUsersOfSkillGroup(request: ListUsersOfSkillGroupRequest): ListUsersOfSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return listUsersOfSkillGroupWithOptions(request, runtime);
}

model ListVoiceAppraiseRequest {
  instanceId?: string(name='InstanceId'),
}

model ListVoiceAppraiseResponseBody = {
  code?: string(name='Code'),
  contactFlow?: {
    appliedVersion?: string(name='AppliedVersion'),
    contactFlowDescription?: string(name='ContactFlowDescription'),
    contactFlowId?: string(name='ContactFlowId'),
    contactFlowName?: string(name='ContactFlowName'),
    instanceId?: string(name='InstanceId'),
    phoneNumbers?: {
      phoneNumber?: [ 
      {
        instanceId?: string(name='InstanceId'),
        number?: string(name='Number'),
        phoneNumberDescription?: string(name='PhoneNumberDescription'),
        phoneNumberId?: string(name='PhoneNumberId'),
        remainingTime?: int32(name='RemainingTime'),
        trunks?: int32(name='Trunks'),
      }
    ](name='PhoneNumber')
    }(name='PhoneNumbers'),
    type?: string(name='Type'),
    versions?: {
      contactFlowVersion?: [ 
      {
        contactFlowVersionDescription?: string(name='ContactFlowVersionDescription'),
        contactFlowVersionId?: string(name='ContactFlowVersionId'),
        content?: string(name='Content'),
        lastModified?: string(name='LastModified'),
        lastModifiedBy?: string(name='LastModifiedBy'),
        status?: string(name='Status'),
        version?: string(name='Version'),
      }
    ](name='ContactFlowVersion')
    }(name='Versions'),
  }(name='ContactFlow'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  notice?: string(name='Notice'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListVoiceAppraiseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListVoiceAppraiseResponseBody(name='body'),
}

async function listVoiceAppraiseWithOptions(request: ListVoiceAppraiseRequest, runtime: Util.RuntimeOptions): ListVoiceAppraiseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListVoiceAppraise',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listVoiceAppraise(request: ListVoiceAppraiseRequest): ListVoiceAppraiseResponse {
  var runtime = new Util.RuntimeOptions{};
  return listVoiceAppraiseWithOptions(request, runtime);
}

model ModifyAgentDeviceRequest {
  agentDeviceId?: long(name='AgentDeviceId'),
  instanceId?: string(name='InstanceId'),
  isLogin?: int32(name='IsLogin'),
}

model ModifyAgentDeviceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyAgentDeviceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyAgentDeviceResponseBody(name='body'),
}

async function modifyAgentDeviceWithOptions(request: ModifyAgentDeviceRequest, runtime: Util.RuntimeOptions): ModifyAgentDeviceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentDeviceId)) {
    query['AgentDeviceId'] = request.agentDeviceId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isLogin)) {
    query['IsLogin'] = request.isLogin;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyAgentDevice',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyAgentDevice(request: ModifyAgentDeviceRequest): ModifyAgentDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyAgentDeviceWithOptions(request, runtime);
}

model ModifyPhoneNumberRequest {
  contactFlowId?: string(name='ContactFlowId'),
  instanceId?: string(name='InstanceId'),
  phoneNumberId?: string(name='PhoneNumberId'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  usage?: string(name='Usage'),
}

model ModifyPhoneNumberResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  phoneNumber?: {
    allowOutbound?: boolean(name='AllowOutbound'),
    contactFlow?: {
      contactFlowDescription?: string(name='ContactFlowDescription'),
      contactFlowId?: string(name='ContactFlowId'),
      contactFlowName?: string(name='ContactFlowName'),
      instanceId?: string(name='InstanceId'),
      type?: string(name='Type'),
    }(name='ContactFlow'),
    instanceId?: string(name='InstanceId'),
    number?: string(name='Number'),
    phoneNumberDescription?: string(name='PhoneNumberDescription'),
    phoneNumberId?: string(name='PhoneNumberId'),
    remainingTime?: int32(name='RemainingTime'),
    skillGroups?: {
      skillGroup?: [ 
      {
        skillGroupId?: string(name='SkillGroupId'),
        skillGroupName?: string(name='SkillGroupName'),
      }
    ](name='SkillGroup')
    }(name='SkillGroups'),
    testOnly?: boolean(name='TestOnly'),
    trunks?: int32(name='Trunks'),
    usage?: string(name='Usage'),
  }(name='PhoneNumber'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyPhoneNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyPhoneNumberResponseBody(name='body'),
}

async function modifyPhoneNumberWithOptions(request: ModifyPhoneNumberRequest, runtime: Util.RuntimeOptions): ModifyPhoneNumberResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowId)) {
    query['ContactFlowId'] = request.contactFlowId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumberId)) {
    query['PhoneNumberId'] = request.phoneNumberId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.usage)) {
    query['Usage'] = request.usage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPhoneNumber',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyPhoneNumber(request: ModifyPhoneNumberRequest): ModifyPhoneNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPhoneNumberWithOptions(request, runtime);
}

model ModifyPhoneTagsRequest {
  instanceId?: string(name='InstanceId'),
  serviceTag?: string(name='ServiceTag'),
  skillGroupIdList?: [ string ](name='SkillGroupIdList'),
}

model ModifyPhoneTagsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyPhoneTagsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyPhoneTagsResponseBody(name='body'),
}

async function modifyPhoneTagsWithOptions(request: ModifyPhoneTagsRequest, runtime: Util.RuntimeOptions): ModifyPhoneTagsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.serviceTag)) {
    query['ServiceTag'] = request.serviceTag;
  }
  if (!Util.isUnset(request.skillGroupIdList)) {
    query['SkillGroupIdList'] = request.skillGroupIdList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPhoneTags',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyPhoneTags(request: ModifyPhoneTagsRequest): ModifyPhoneTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPhoneTagsWithOptions(request, runtime);
}

model ModifyPrimaryTrunksOfSkillGroupRequest {
  instanceId?: string(name='InstanceId'),
  primaryProviderName?: [ string ](name='PrimaryProviderName'),
  skillGroupId?: string(name='SkillGroupId'),
}

model ModifyPrimaryTrunksOfSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyPrimaryTrunksOfSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyPrimaryTrunksOfSkillGroupResponseBody(name='body'),
}

async function modifyPrimaryTrunksOfSkillGroupWithOptions(request: ModifyPrimaryTrunksOfSkillGroupRequest, runtime: Util.RuntimeOptions): ModifyPrimaryTrunksOfSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.primaryProviderName)) {
    query['PrimaryProviderName'] = request.primaryProviderName;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPrimaryTrunksOfSkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyPrimaryTrunksOfSkillGroup(request: ModifyPrimaryTrunksOfSkillGroupRequest): ModifyPrimaryTrunksOfSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPrimaryTrunksOfSkillGroupWithOptions(request, runtime);
}

model ModifyPrivacyNumberCallDetailRequest {
  callId?: string(name='CallId'),
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
}

model ModifyPrivacyNumberCallDetailResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyPrivacyNumberCallDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyPrivacyNumberCallDetailResponseBody(name='body'),
}

async function modifyPrivacyNumberCallDetailWithOptions(request: ModifyPrivacyNumberCallDetailRequest, runtime: Util.RuntimeOptions): ModifyPrivacyNumberCallDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.callId)) {
    query['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPrivacyNumberCallDetail',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyPrivacyNumberCallDetail(request: ModifyPrivacyNumberCallDetailRequest): ModifyPrivacyNumberCallDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPrivacyNumberCallDetailWithOptions(request, runtime);
}

model ModifySkillGroupRequest {
  allowPrivateOutboundNumber?: boolean(name='AllowPrivateOutboundNumber'),
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  outboundPhoneNumberId?: [ string ](name='OutboundPhoneNumberId'),
  routingStrategy?: string(name='RoutingStrategy'),
  skillGroupId?: string(name='SkillGroupId'),
  skillLevel?: [ int32 ](name='SkillLevel'),
  userId?: [ string ](name='UserId'),
}

model ModifySkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifySkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySkillGroupResponseBody(name='body'),
}

async function modifySkillGroupWithOptions(request: ModifySkillGroupRequest, runtime: Util.RuntimeOptions): ModifySkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.allowPrivateOutboundNumber)) {
    query['AllowPrivateOutboundNumber'] = request.allowPrivateOutboundNumber;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.outboundPhoneNumberId)) {
    query['OutboundPhoneNumberId'] = request.outboundPhoneNumberId;
  }
  if (!Util.isUnset(request.routingStrategy)) {
    query['RoutingStrategy'] = request.routingStrategy;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillLevel)) {
    query['SkillLevel'] = request.skillLevel;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySkillGroup(request: ModifySkillGroupRequest): ModifySkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySkillGroupWithOptions(request, runtime);
}

model ModifySkillGroupBasicInfoRequest {
  allowPrivateOutboundNumber?: boolean(name='AllowPrivateOutboundNumber'),
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  routingStrategy?: string(name='RoutingStrategy'),
  skillGroupId?: string(name='SkillGroupId'),
}

model ModifySkillGroupBasicInfoResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifySkillGroupBasicInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySkillGroupBasicInfoResponseBody(name='body'),
}

async function modifySkillGroupBasicInfoWithOptions(request: ModifySkillGroupBasicInfoRequest, runtime: Util.RuntimeOptions): ModifySkillGroupBasicInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.allowPrivateOutboundNumber)) {
    query['AllowPrivateOutboundNumber'] = request.allowPrivateOutboundNumber;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.routingStrategy)) {
    query['RoutingStrategy'] = request.routingStrategy;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySkillGroupBasicInfo',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySkillGroupBasicInfo(request: ModifySkillGroupBasicInfoRequest): ModifySkillGroupBasicInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySkillGroupBasicInfoWithOptions(request, runtime);
}

model ModifySkillGroupOfUserRequest {
  instanceId?: string(name='InstanceId'),
  roleId?: [ string ](name='RoleId'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  skillLevel?: [ int32 ](name='SkillLevel'),
  userId?: string(name='UserId'),
}

model ModifySkillGroupOfUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifySkillGroupOfUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySkillGroupOfUserResponseBody(name='body'),
}

async function modifySkillGroupOfUserWithOptions(request: ModifySkillGroupOfUserRequest, runtime: Util.RuntimeOptions): ModifySkillGroupOfUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.roleId)) {
    query['RoleId'] = request.roleId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillLevel)) {
    query['SkillLevel'] = request.skillLevel;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySkillGroupOfUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySkillGroupOfUser(request: ModifySkillGroupOfUserRequest): ModifySkillGroupOfUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySkillGroupOfUserWithOptions(request, runtime);
}

model ModifySkillGroupOutboundNumbersRequest {
  instanceId?: string(name='InstanceId'),
  operationType?: int32(name='OperationType'),
  outboundPhoneNumberId?: [ string ](name='OutboundPhoneNumberId'),
  skillGroupId?: string(name='SkillGroupId'),
}

model ModifySkillGroupOutboundNumbersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifySkillGroupOutboundNumbersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifySkillGroupOutboundNumbersResponseBody(name='body'),
}

async function modifySkillGroupOutboundNumbersWithOptions(request: ModifySkillGroupOutboundNumbersRequest, runtime: Util.RuntimeOptions): ModifySkillGroupOutboundNumbersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.outboundPhoneNumberId)) {
    query['OutboundPhoneNumberId'] = request.outboundPhoneNumberId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySkillGroupOutboundNumbers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifySkillGroupOutboundNumbers(request: ModifySkillGroupOutboundNumbersRequest): ModifySkillGroupOutboundNumbersResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySkillGroupOutboundNumbersWithOptions(request, runtime);
}

model ModifyUserRequest {
  displayName?: string(name='DisplayName'),
  email?: string(name='Email'),
  instanceId?: string(name='InstanceId'),
  phone?: string(name='Phone'),
  privateOutboundNumberId?: string(name='PrivateOutboundNumberId'),
  roleId?: [ string ](name='RoleId'),
  skillGroupId?: [ string ](name='SkillGroupId'),
  skillLevel?: [ int32 ](name='SkillLevel'),
  userId?: string(name='UserId'),
}

model ModifyUserResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyUserResponseBody(name='body'),
}

async function modifyUserWithOptions(request: ModifyUserRequest, runtime: Util.RuntimeOptions): ModifyUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phone)) {
    query['Phone'] = request.phone;
  }
  if (!Util.isUnset(request.privateOutboundNumberId)) {
    query['PrivateOutboundNumberId'] = request.privateOutboundNumberId;
  }
  if (!Util.isUnset(request.roleId)) {
    query['RoleId'] = request.roleId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillLevel)) {
    query['SkillLevel'] = request.skillLevel;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyUser',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyUser(request: ModifyUserRequest): ModifyUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyUserWithOptions(request, runtime);
}

model PickGlobalOutboundNumbersRequest {
  calleeNumber?: string(name='CalleeNumber'),
  count?: int32(name='Count'),
  instanceId?: string(name='InstanceId'),
  isVirtual?: boolean(name='IsVirtual'),
  skillGroupId?: [ string ](name='SkillGroupId'),
}

model PickGlobalOutboundNumbersResponseBody = {
  code?: string(name='Code'),
  dialNumberPairs?: {
    dialNumberPair?: [ 
    {
      callee?: {
        city?: string(name='City'),
        number?: string(name='Number'),
        province?: string(name='Province'),
      }(name='Callee'),
      caller?: {
        city?: string(name='City'),
        number?: string(name='Number'),
        province?: string(name='Province'),
      }(name='Caller'),
    }
  ](name='DialNumberPair')
  }(name='DialNumberPairs'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PickGlobalOutboundNumbersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PickGlobalOutboundNumbersResponseBody(name='body'),
}

async function pickGlobalOutboundNumbersWithOptions(request: PickGlobalOutboundNumbersRequest, runtime: Util.RuntimeOptions): PickGlobalOutboundNumbersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.calleeNumber)) {
    query['CalleeNumber'] = request.calleeNumber;
  }
  if (!Util.isUnset(request.count)) {
    query['Count'] = request.count;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isVirtual)) {
    query['IsVirtual'] = request.isVirtual;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PickGlobalOutboundNumbers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pickGlobalOutboundNumbers(request: PickGlobalOutboundNumbersRequest): PickGlobalOutboundNumbersResponse {
  var runtime = new Util.RuntimeOptions{};
  return pickGlobalOutboundNumbersWithOptions(request, runtime);
}

model PickLocalNumberRequest {
  calleeNumber?: string(name='CalleeNumber'),
  candidateNumber?: [ string ](name='CandidateNumber'),
  instanceId?: string(name='InstanceId'),
}

model PickLocalNumberResponseBody = {
  code?: string(name='Code'),
  data?: {
    callee?: {
      city?: string(name='City'),
      number?: string(name='Number'),
      province?: string(name='Province'),
    }(name='Callee'),
    caller?: {
      city?: string(name='City'),
      number?: string(name='Number'),
      province?: string(name='Province'),
    }(name='Caller'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PickLocalNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PickLocalNumberResponseBody(name='body'),
}

async function pickLocalNumberWithOptions(request: PickLocalNumberRequest, runtime: Util.RuntimeOptions): PickLocalNumberResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.calleeNumber)) {
    query['CalleeNumber'] = request.calleeNumber;
  }
  if (!Util.isUnset(request.candidateNumber)) {
    query['CandidateNumber'] = request.candidateNumber;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PickLocalNumber',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pickLocalNumber(request: PickLocalNumberRequest): PickLocalNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return pickLocalNumberWithOptions(request, runtime);
}

model PickOutboundNumbersRequest {
  calleeNumber?: string(name='CalleeNumber'),
  candidateNumber?: [ string ](name='CandidateNumber'),
  count?: int32(name='Count'),
  instanceId?: string(name='InstanceId'),
}

model PickOutboundNumbersResponseBody = {
  code?: string(name='Code'),
  dialNumberPairs?: {
    dialNumberPair?: [ 
    {
      callee?: {
        city?: string(name='City'),
        number?: string(name='Number'),
        province?: string(name='Province'),
      }(name='Callee'),
      caller?: {
        city?: string(name='City'),
        number?: string(name='Number'),
        province?: string(name='Province'),
      }(name='Caller'),
    }
  ](name='DialNumberPair')
  }(name='DialNumberPairs'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PickOutboundNumbersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PickOutboundNumbersResponseBody(name='body'),
}

async function pickOutboundNumbersWithOptions(request: PickOutboundNumbersRequest, runtime: Util.RuntimeOptions): PickOutboundNumbersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.calleeNumber)) {
    query['CalleeNumber'] = request.calleeNumber;
  }
  if (!Util.isUnset(request.candidateNumber)) {
    query['CandidateNumber'] = request.candidateNumber;
  }
  if (!Util.isUnset(request.count)) {
    query['Count'] = request.count;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PickOutboundNumbers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pickOutboundNumbers(request: PickOutboundNumbersRequest): PickOutboundNumbersResponse {
  var runtime = new Util.RuntimeOptions{};
  return pickOutboundNumbersWithOptions(request, runtime);
}

model PublishContactFlowVersionRequest {
  contactFlowVersionId?: string(name='ContactFlowVersionId'),
  instanceId?: string(name='InstanceId'),
  useTianGong?: boolean(name='UseTianGong'),
}

model PublishContactFlowVersionResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model PublishContactFlowVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PublishContactFlowVersionResponseBody(name='body'),
}

async function publishContactFlowVersionWithOptions(request: PublishContactFlowVersionRequest, runtime: Util.RuntimeOptions): PublishContactFlowVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactFlowVersionId)) {
    query['ContactFlowVersionId'] = request.contactFlowVersionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.useTianGong)) {
    query['UseTianGong'] = request.useTianGong;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PublishContactFlowVersion',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function publishContactFlowVersion(request: PublishContactFlowVersionRequest): PublishContactFlowVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return publishContactFlowVersionWithOptions(request, runtime);
}

model RefreshTokenRequest {
  instanceId?: string(name='InstanceId'),
}

model RefreshTokenResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  token?: {
    signData?: string(name='SignData'),
    signature?: string(name='Signature'),
  }(name='Token'),
}

model RefreshTokenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RefreshTokenResponseBody(name='body'),
}

async function refreshTokenWithOptions(request: RefreshTokenRequest, runtime: Util.RuntimeOptions): RefreshTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RefreshToken',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function refreshToken(request: RefreshTokenRequest): RefreshTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return refreshTokenWithOptions(request, runtime);
}

model RemovePhoneNumberRequest {
  instanceId?: string(name='InstanceId'),
  phoneNumberId?: string(name='PhoneNumberId'),
}

model RemovePhoneNumberResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RemovePhoneNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RemovePhoneNumberResponseBody(name='body'),
}

async function removePhoneNumberWithOptions(request: RemovePhoneNumberRequest, runtime: Util.RuntimeOptions): RemovePhoneNumberResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumberId)) {
    query['PhoneNumberId'] = request.phoneNumberId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RemovePhoneNumber',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function removePhoneNumber(request: RemovePhoneNumberRequest): RemovePhoneNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return removePhoneNumberWithOptions(request, runtime);
}

model RemoveUsersRequest {
  instanceId?: string(name='InstanceId'),
  userId?: [ string ](name='UserId'),
}

model RemoveUsersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RemoveUsersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RemoveUsersResponseBody(name='body'),
}

async function removeUsersWithOptions(request: RemoveUsersRequest, runtime: Util.RuntimeOptions): RemoveUsersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RemoveUsers',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function removeUsers(request: RemoveUsersRequest): RemoveUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeUsersWithOptions(request, runtime);
}

model RemoveUsersFromSkillGroupRequest {
  instanceId?: string(name='InstanceId'),
  skillGroupId?: string(name='SkillGroupId'),
  userId?: [ string ](name='UserId'),
}

model RemoveUsersFromSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RemoveUsersFromSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RemoveUsersFromSkillGroupResponseBody(name='body'),
}

async function removeUsersFromSkillGroupWithOptions(request: RemoveUsersFromSkillGroupRequest, runtime: Util.RuntimeOptions): RemoveUsersFromSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RemoveUsersFromSkillGroup',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function removeUsersFromSkillGroup(request: RemoveUsersFromSkillGroupRequest): RemoveUsersFromSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeUsersFromSkillGroupWithOptions(request, runtime);
}

model RequestLoginInfoRequest {
  instanceId?: string(name='InstanceId'),
  userId?: string(name='UserId'),
}

model RequestLoginInfoResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  loginInfo?: {
    agentServerUrl?: string(name='AgentServerUrl'),
    displayName?: string(name='DisplayName'),
    extension?: string(name='Extension'),
    phoneNumber?: string(name='PhoneNumber'),
    region?: string(name='Region'),
    roles?: {
      role?: [ 
      {
        instanceId?: string(name='InstanceId'),
        roleDescription?: string(name='RoleDescription'),
        roleId?: string(name='RoleId'),
        roleName?: string(name='RoleName'),
      }
    ](name='Role')
    }(name='Roles'),
    signData?: string(name='SignData'),
    signature?: string(name='Signature'),
    tenantId?: string(name='TenantId'),
    userName?: string(name='UserName'),
    webRtcUrl?: string(name='WebRtcUrl'),
  }(name='LoginInfo'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RequestLoginInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RequestLoginInfoResponseBody(name='body'),
}

async function requestLoginInfoWithOptions(request: RequestLoginInfoRequest, runtime: Util.RuntimeOptions): RequestLoginInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RequestLoginInfo',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function requestLoginInfo(request: RequestLoginInfoRequest): RequestLoginInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return requestLoginInfoWithOptions(request, runtime);
}

model ResetUserStatusRequest {
  instanceId?: string(name='InstanceId'),
  ramIdList?: [ long ](name='RamIdList'),
}

model ResetUserStatusResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ResetUserStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ResetUserStatusResponseBody(name='body'),
}

async function resetUserStatusWithOptions(request: ResetUserStatusRequest, runtime: Util.RuntimeOptions): ResetUserStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ramIdList)) {
    query['RamIdList'] = request.ramIdList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetUserStatus',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resetUserStatus(request: ResetUserStatusRequest): ResetUserStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetUserStatusWithOptions(request, runtime);
}

model SaveWebRTCStatsRequest {
  callId?: string(name='CallId'),
  callStartTime?: long(name='CallStartTime'),
  calleeNumber?: string(name='CalleeNumber'),
  callerNumber?: string(name='CallerNumber'),
  instanceId?: string(name='InstanceId'),
  recordTime?: long(name='RecordTime'),
  stats?: string(name='Stats'),
  tenantId?: string(name='TenantId'),
  uid?: string(name='Uid'),
}

model SaveWebRTCStatsResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  rowCount?: long(name='RowCount'),
  success?: boolean(name='Success'),
}

model SaveWebRTCStatsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveWebRTCStatsResponseBody(name='body'),
}

async function saveWebRTCStatsWithOptions(request: SaveWebRTCStatsRequest, runtime: Util.RuntimeOptions): SaveWebRTCStatsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.callId)) {
    query['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.callStartTime)) {
    query['CallStartTime'] = request.callStartTime;
  }
  if (!Util.isUnset(request.calleeNumber)) {
    query['CalleeNumber'] = request.calleeNumber;
  }
  if (!Util.isUnset(request.callerNumber)) {
    query['CallerNumber'] = request.callerNumber;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.recordTime)) {
    query['RecordTime'] = request.recordTime;
  }
  if (!Util.isUnset(request.stats)) {
    query['Stats'] = request.stats;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.uid)) {
    query['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveWebRTCStats',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveWebRTCStats(request: SaveWebRTCStatsRequest): SaveWebRTCStatsResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveWebRTCStatsWithOptions(request, runtime);
}

model SendPredefinedShortMessageRequest {
  configId?: long(name='ConfigId'),
  instanceId?: string(name='InstanceId'),
  phoneNumbers?: string(name='PhoneNumbers'),
  templateParam?: string(name='TemplateParam'),
}

model SendPredefinedShortMessageResponseBody = {
  bizId?: string(name='BizId'),
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendPredefinedShortMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendPredefinedShortMessageResponseBody(name='body'),
}

async function sendPredefinedShortMessageWithOptions(request: SendPredefinedShortMessageRequest, runtime: Util.RuntimeOptions): SendPredefinedShortMessageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.configId)) {
    query['ConfigId'] = request.configId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumbers)) {
    query['PhoneNumbers'] = request.phoneNumbers;
  }
  if (!Util.isUnset(request.templateParam)) {
    query['TemplateParam'] = request.templateParam;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SendPredefinedShortMessage',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendPredefinedShortMessage(request: SendPredefinedShortMessageRequest): SendPredefinedShortMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendPredefinedShortMessageWithOptions(request, runtime);
}

model StartBack2BackCallRequest {
  callCenterNumber?: string(name='CallCenterNumber'),
  callee?: string(name='Callee'),
  caller?: string(name='Caller'),
  instanceId?: string(name='InstanceId'),
  workflowId?: string(name='WorkflowId'),
}

model StartBack2BackCallResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  statusCode?: string(name='StatusCode'),
  statusDesc?: string(name='StatusDesc'),
  success?: boolean(name='Success'),
  taskId?: string(name='TaskId'),
  timeStamp?: string(name='TimeStamp'),
}

model StartBack2BackCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartBack2BackCallResponseBody(name='body'),
}

async function startBack2BackCallWithOptions(request: StartBack2BackCallRequest, runtime: Util.RuntimeOptions): StartBack2BackCallResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.callCenterNumber)) {
    query['CallCenterNumber'] = request.callCenterNumber;
  }
  if (!Util.isUnset(request.callee)) {
    query['Callee'] = request.callee;
  }
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.workflowId)) {
    query['WorkflowId'] = request.workflowId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartBack2BackCall',
    version = '2017-07-05',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startBack2BackCall(request: StartBack2BackCallRequest): StartBack2BackCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return startBack2BackCallWithOptions(request, runtime);
}

